ITeye博客

mvc:annotation-driven 注解

perfy315 · 2012-03-09 15:22 · spring · 企业架构 · Spring · MVC · Markdown

[color=red][/color] 相当于注册了DefaultAnnotationHandlerMapping和AnnotationMethodHandlerAdapter两个bean,配置一些messageconverter。即解决了@Controller注解的使用前提配置。 [color=red][/color] 1)隐式地向Spring容器中注册AutowiredAnnotationBeanPostProcessor、CommonAnnotationBeanPostProcessor、PersistenceAnnotationBeanPostProcessor 及 equiredAnnotationBeanPostProcessor 这 4 个 BeanPostProcessor。 在配置文件中使用之前,必须在 元素中声明 context 命名空间。 2)是对包进行扫描,实现注释驱动Bean定义,同时将bean自动注入容器中使用。即解决了@Controller标识的类的bean的注入和使用。 [color=red] [/color] 配置项不但启用了对类包进行扫描以实施注释驱动 Bean 定义的功能,同时还启用了注释驱动自动注入的功能(即还隐式地在内部注册了 AutowiredAnnotationBeanPostProcessor 和 CommonAnnotationBeanPostProcessor),因此当使用 后,除非需要使用PersistenceAnnotationBeanPostProcessor和equiredAnnotationBeanPostProcessor两个Processor的功能(例如JPA等)否则就可以将 移除了。 (转:http://bbs.shopxx.net/read-htm-tid-10645.html) spring mvc 会自动启动Spring MVC的注解功能,但实际它做了哪些工作呢?

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。