1
我已經在我的項目互斥config配置類:Config1
和Config2
,我要選擇一個在單元測試,如:我可以在Spring JUnit測試中使用@Import嗎?
public class Config1 {
@Bean
FooBean foo() {
return new FooBean();
}
}
(I must remove the `@Configuration` annotation, so I can choose one in the application)
而且,
@RunWith(SpringJUnit4ClassRunner.class)
@Import(Config1.class)
public class FooTest {
@Inject
FooBean foo;
// ...
}
但是,它看起來像JUnit4ClassRunner
在測試類中看不到@Import
註釋。