例如,现在我必须在每个测试类中完成
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(loader=AnnotationConfigContextLoader.class)
Run Code Online (Sandbox Code Playgroud)
我想摆脱
@ContextConfiguration(loader=AnnotationConfigContextLoader.class)
Run Code Online (Sandbox Code Playgroud)
并希望Spring扫描我项目中的所有bean.
我怎样才能做到这一点?
文件说明:
开发自动配置和使用条件
如果您在开发共享库的公司工作,或者您在开源或商业库中工作,则可能需要开发自己的自动配置.自动配置类可以捆绑在外部jar中,仍然可以通过Spring Boot获取.
如果我有其他所有注释(甚至@AutoConfigureAfter或@AutoConfigureBefore注释),
为什么要将属性文件维护为指向带注释的类?