Jan Galinski Jan Galinski - 3 months ago 36
Java Question

How to hide spring boot banner.txt in junit test with SpringJUnit4TestRunner?

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:

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: