我有一个以下课程
@ComponentScan(basePackages = { "com.abc.def" })
@Configuration
public class ClassUnderTest(){
@Bean
public void createSomeBean()
{
}
}
我正在使用
对该课程进行单元测试@RunWith(SpringRunner.class)
@ContextConfiguration(classes = ClassUnderTest.class)
public class someUnitTest()
{}
从ClassUnderTest创建测试上下文时,如何防止组件扫描发生
答案 0 :(得分:0)
@ComponentScan(basePackages = "com.abc.def",
excludeFilters = {
@Filter(type = ASSIGNABLE_TYPE,
value = {
ClassUnderTest.class
})
})