<mvc:annotation-driven/>作用

 
 

一、直接查看spring帮助文档

1、打开版本 spring 4.2.5 帮助文档: spring4.2.5\spring-framework-4.2.5.RELEASE\docs\spring-framework- reference\htmlsingle\index.html 2、打开21.16.1 Enabling the MVC Java Config or the MVC XML Namespace(其它版本类似,找到大类 The Web 下的小类 Configuring Spring MVC,然后打开第一个就好)。 3、进去就是<mvc:annotation-driven/>的介绍。

二、以下我自己的理解(其实就是小翻译 ε(┬┬﹏┬┬)3)

1、会自动注册 RequestMappingHandlerMappingRequestMappingHandlerAdapterExceptionHandlerExceptionResolver三个bean支持使用了像@RquestMapping@ExceptionHandler等等的注解的controller 方法去处理请求。 2、支持使用了 ConversionService的实例对表单参数进行类型转换。 3、支持使用@NumberFormat@NumberFormat注解对数据类型进行格式化。 4、支持使用@Valid对javaBean进行JSR-303验证。 5、支持使用@RequestBody @ResponseBody

作者:包子烦恼 链接:http://www.jianshu.com/p/e154c0cdcddd 來源:简书 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

猜你喜欢

转载自blog.csdn.net/mym43210/article/details/78362325