context:component-scan 分析
<context:component-scan>
Web.xml中
<servlet>
<servlet-name>springMVC</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:springMVC.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
如下配置
<context:component-scan base-package="com.xt.web.controller" />
<context:component-scan base-package="com.xt" /> //暂时有错
springMVC.xml中需要能扫描到Controller.
否则出现:
org.springframework.web.servlet.PageNotFound noHandlerFound
警告: No mapping found for HTTP request with URI [/traffic/w] in DispatcherServlet with name 'springMVC'。
1.Web.xml中
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-hibernate.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
spring-hibernate.xml文件中配置serivce,dao等spring要素。
<context:component-scan base-package="com.xt.domain" />
//路径需要到dao,service等javabean的目录的上级目录.
context:component-scan 分析的更多相关文章
- [Spring Boot] Use Component Scan to scan for Bean
Component Scan is important concept when we want to create Bean. Currently we know what, for the cla ...
- Context源码分析
我们做安卓开发,时时都在和Context打交道,那么Context到底是什么?有什么作用?如何与Application,Activity,Service等实例发生联系的?等等 Context是什么? ...
- get****Context各个方法分析
1 getApplicationContext分析 该方法为contextImpl类的方法,返回一个ApplicationContext.方法代码为: public Context getApplic ...
- go context 源码分析
WithCancel func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { c := newCancelCtx(pare ...
- SGA: allocation forcing component growth分析
1.问题现象 20年12月31日,数据库应用人员反映2020-12-31 12:40:10存在告警,过了几分钟之后业务恢复正常. 表现的状态:Connect to database time out, ...
- yii2 源码分析 Component类分析 (二)
转载请注明链接http://www.cnblogs.com/liuwanqiu/p/6739538.html 组件(component),是Yii框架的基类,实现了属性.事件.行为三类功能,它集成自o ...
- android中LayoutInflater.from(context).inflate的分析
在应用中自定义一个view,需要获取这个view的布局,需要用到 (LinearLayout) LayoutInflater.from(context).inflate(R.layout.conten ...
- SpringBoot自动配置(装配)流程
源码分析 SpringBoot自动配置流程 首先,我们要了解在@SpringBootApplication注解的内部,还具有@EnableAutoConfiguration,@SpringBo ...
- spring boot2.0
1. Spring boot 简介 1.1 spring boot的三大特性 组件自动装配:Web mvc, Web Flux,JDBC等 激活:@EnableAutoConfiguration 配置 ...
- RESTful Demo
Demo 功能 两个模块, App 与 Admin, App 模块提供增加用户(/add?name=${name})与查询用户(/query/${id}), Admin 模块提供列出所有用户(/lis ...
随机推荐
- makefile_1(初识make)
Makefile有三个非常有用的变量.分别是$@,$^,$<代表的意义分别是: $@--目标文件,$^--所有的依赖文件,$<--第一个依赖文件. LIBS = -lmCFLAGS = - ...
- Android之ExpandableListView
ExpandableListView可以用来表现多层级的listView,本文主要是ExpandableListView的一个简单实现 布局文件 <LinearLayout xmlns:andr ...
- 解决zabbix图中出现中文乱码问题 图中的中文会变成方块
[root@node03 src]# wget http://down1.chinaunix.net/distfiles/ttf-arphic-uming_0.0.20050501-1.tar.gz ...
- 如何为Linux生成和打上patch
通过diff工具生成补丁, patch工具打上补丁. 在使用diff之前, 你需要保留一份未修改过的源码, 然后在其它地方修改源码的一份拷贝. diff对比这两份源码生成patch. 修改过的源码必须 ...
- js checkbox
js checkbox <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:/ ...
- hdu 4296 贪心
证明转自: here 题意:有 n 个地板,每个地板 i 有两个权值 Wi, Si,且 PDV(i) = (ΣWj) - Si ( j 表示在 i 上面的地板).问如何调整顺序,使得[max(PD ...
- SQL Server2008跟SQL Server2008R2的区别(转)
QL Server 2008 R2基于SQL Server 2008提供可靠高效的智能数据平台构建而成,SQL Server 2008 R2 提供了大量新改进,可帮助您的组织满怀信心地调整规模.提高 ...
- css实现三角形图标
css边框和相框构造是一样的,看下面这代css代码: <div style="border-color: red blue black green;border-style: soli ...
- 对于java中的变量问题
基本类型的变量如果是临时变量,只要定义了,就会分配内存空间,不管是否被赋值:如果是作为对象的属性出现,只要该对象不实例化,就不会分配内存空间.一个完整的Java程序运行过程会涉及以下内存区域:1.寄存 ...
- 【练习】使用接口回调和handler实现数据加载到listview
代码结构 布局: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xml ...