<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注解驱动详解
本文介绍了Spring MVC中<mvc:annotation-driven/>的作用及其提供的功能,包括默认配置方案、请求分发机制及JSON支持等内容。同时对比了<context:annotation-config>的区别,并给出了实际开发中的建议。
4万+

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



