前者 < mvc:annotation-driven> 在web.xml中DispatcherServlet指定的配置文件,标志启动注解驱动, 是spring MVC为@Controllers分发请求所必须的,需要写。
后者在web.xml中的contextConfigLocation指定的配置文件中,当使用 < context:component-scan/> 后,就可以将 < context:annotation-config/> 移除了。
前者 < mvc:annotation-driven> 在web.xml中DispatcherServlet指定的配置文件,标志启动注解驱动, 是spring MVC为@Controllers分发请求所必须的,需要写。
后者在web.xml中的contextConfigLocation指定的配置文件中,当使用 < context:component-scan/> 后,就可以将 < context:annotation-config/> 移除了。