<context:annotation-config> declares support for general annotations such as @Required, @Autowired, @PostConstruct,
and so on.
<mvc:annotation-driven /> is actually rather pointless. It declares explicit support for annotation-driven MVC controllers (i.e.@RequestMapping, @Controller,
etc), even though support for those is the default behaviour.
My advice is to always declare <context:annotation-config>, but don't bother with <mvc:annotation-driven /> unless you want JSON support via Jackson.
本文深入解析了Spring MVC中的mvc:annotation-driven注解的意义、作用及使用场景,包括其自动注册的bean及其提供的功能支持,以及如何在处理AJAX请求和JUnit单元测试中利用这些功能。
4万+

被折叠的 条评论
为什么被折叠?



