Jan Galinski Jan Galinski - 1 year ago 101
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)...

Answer Source

You can put this in your test properties:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download