Solve the problem of springboot and unit test starting applicationrunner

During the execution of unit test, applicationrunner was started unexpectedly, resulting in the initialization of netty server and the failure of unit test execution.

Solution: by setting the profile of bean corresponding to applicationrunner

Add notes to corresponding components:

@Profile(“! test”)

Add notes to unit tests:

@ActiveProfiles(“test”)

Read More: