<mvc:annotation-driven />

<mvc:annotation-driven /> 会自动注册DefaultAnnotationHandlerMappingAnnotationMethodHandlerAdapter两个bean,是spring MVC为@Controllers分发请求所必须的。并提供了:数据绑定支持,@NumberFormatannotation支持,@DateTimeFormat支持,@Valid支持,读写XML的支持(JAXB),读写JSON的支持(Jackson)。

<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.

推荐阅读更多精彩内容