在Spring中,如果代替下面的示例,而不是仅@EnableWebMvc与@Configurationuse一起使用,将会发生什么@EnableWebMvc?和 @Configuration@Configuration@EnableWebMvcpublic class Clazz { // ..}没有 @Configuration@EnableWebMvcpublic class Clazz { // ..}
1 回答
明月笑刀无情
TA贡献1828条经验 获得超4个赞
@EnableWebMvc除非被Spring发现,否则它本身不能做很多事情。Spring搜索标记为的类@Component。@Configuration标记为@Component,因此所有标记为的类@Configuration都由Spring组件扫描发现,与标记为的类相同@Component。@EnableWebMvc标记的类只有在用标记@Component或带有标记的任何注释时才被发现@Component
添加回答
举报
0/150
提交
取消
