I have a Java web app with spring boot
When run test I need to exclude some Java config files:
Test config (need to include when test run):
@
You can use @ConditionalOnMissingClass("org.springframework.test.context.junit4.SpringJUnit4ClassRunner") in Configuration class.SpringJUnit4ClassRunner can be replaced by any class which only exits in test environment.
@ConditionalOnMissingClass("org.springframework.test.context.junit4.SpringJUnit4ClassRunner")
SpringJUnit4ClassRunner