context:conponent-scan和mvc:annotation-driven的作用?
来源:互联网 发布:淘宝闲鱼下载 编辑:程序博客网 时间:2024/06/05 20:33
(1)<context:conponent-scan basePackage=""/>:让Spring容器扫描指定包,并注册被@Component,@Controller,@Service,@Repository等注解标记的组件。
接口BeanDefinitionParser下与组件扫描相关的类ComponentScanBeanDefinitionParser将注解解析成bean实例。
(2)<mvc:annotation-driven/>:Spring会自动为我们注册下面说到的几个Bean到工厂中,来处理我们的请求(前两个是重点)
接口BeanDefinitionParser下的与mvc注解驱动相关的类org.springframework.web.servlet.config.AnnotationDrivenBeanDefinitionParse下,注册了下面8个bean实例
2 BeanNameUrlHandlerMapping:将controller的类名映射成请求url
3 RequestMappingHandlerAdapter:处理@Controller注解的处理器,支持自定义方法参数和返回值(很酷)
4 HttpRequestHandlerAdapter:处理继承HttpRequestHandler的处理器
5 SimpleControllerHandlerAdapter:处理继承自Controller接口的处理器
6 ExceptionHandlerExceptionResolver:处理异常的解析器
7 ResponseStatusExceptionResolver
8 DefaultHandlerExceptionResolver
(3)<context:annotation-config/>:隐式的告诉容器扫描注解,一般用conponent-scan,不用此标签。
阅读全文
0 0
- context:conponent-scan和mvc:annotation-driven的作用?
- <context:component-scan/>和<mvc:annotation-driven/>的区别
- <context:component-scan/>和<mvc:annotation-driven/>的区别
- 请教<context:component-scan/>和<mvc:annotation-driven/>的区别
- <context:annotation-config/>,<mvc:annotation-driven/>和<context:component-scan>之间的关系
- <context:component-scan/>和<mvc:annotation-driven/>区别
- 剖析<context:component-scan/>、<mvc:annotation-driven/>
- <context:component-scan/> <mvc:annotation-driven />
- <context:component-scan/> <mvc:annotation-driven /> 区别
- <mvc:annotation-driven/>,<context:annotation-config/>,<context:component-scan/>详解
- <mvc:annotation-driven/> <context:annotation-config/> <context:component-scan>
- <mvc:annotation-driven/>、<context:component-scan base-package=""/>、<context:annotation-config/>的用法
- <mvc:annotation-driven/>、<context:component-scan base-package=""/>、<context:annotation-config/>的用法
- <mvc:annotation-driven/>、<context:component-scan base-package=""/>、<context:annotation-config/>的用法
- [spring-mvc] <context:component-scan/> <mvc:annotation-driven/>
- spring mvc 中mvc:annotation-driven和context:component-scan区别
- spring mvc <mvc:annotation-driven/> 和<context:component-scan base-package=""/>解释
- <mvc:annotation-driven>和<context:annotation-config>
- 简单的通信
- 批量梯度下降和随机梯度下降
- UnityShader入门精要学习笔记(十八):均值模糊与高斯模糊
- 判断SwipeRefreshLayout的childView是否到达顶部
- Several ports (8005, 8080, 8009) required by Tomcat v7.0 Server at localhost are already in use. The
- context:conponent-scan和mvc:annotation-driven的作用?
- 设置端口映射或DMZ主机---将内网web服务器映射入公网
- Retrofit2封装之路(请求参数加密解密)(一)
- 数塔——DP算法
- Android for All 术语表
- javascript
- 《neural network and deep learning》题解——ch02 Network源码分析
- 黑盒测试(功能测试)
- springboot之AOP配置