When I configure an Spring Boot Application, I can disable the banner via run configuration in the static main method. So far so good.
But what if I have the following:
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes={MyApplication.class})
public class MyApplicationTest {
....
}
When I run this test, it does not use the static main method and the banner is displayed, making it harder to focus on the relevant logging statements.
Is there a switch or config annotation I can use to simulate new SpringApplication(MayApplicationclass).setShowBanner(false)...?
You can put this in your test properties:
spring.main.show_banner=false
You can specify the property in your test annotation:
@SpringBootTest(properties="spring.main.banner-mode=off")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With