<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.
当我们需要controller返回一个map的json对象时,可以设定<mvc:annotation-driven />,
同时设定<mvc:message-converters> 标签,设定字符集和json处理类