I tried:
@RunWith(SpringJUnit4ClassRunner.class)
@EnableAutoConfiguration(exclude=CrshAutoConfiguration.class)
@SpringApplicationConfiguration(classes = Appl
With the new @SpringBootTest annotation, I took this answer and modified it to use profiles with a @SpringBootApplication
configuration class. The @Profile
annotation is necessary so that this class is only picked up during the specific integration tests that need this, as other test configurations do different component scanning.
Here is the configuration class:
@Profile("specific-profile")
@SpringBootApplication(scanBasePackages={"com.myco.package1", "com.myco.package2"})
public class SpecificTestConfig {
}
Then, the test class references this configuration class:
@RunWith(SpringRunner.class)
@SpringBootTest(classes = { SpecificTestConfig.class })
@ActiveProfiles({"specific-profile"})
public class MyTest {
}