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 ...
随机推荐
- mongodb数据结构学习1--增删改查
插入文档 在数据库中,数据插入是最基本的操作,在MongoDB使用db.collection.insert(document)语句来插入文档: document是文档数据,collection是存放文 ...
- 关于printf函数输出先后顺序的讲解!!
对于printf函数printf("%d%d\n",a,b);函数的实际输出顺序是这样的先计算出b,然后在计算a,接着输出a,最后在输出b:例子如下:#include<ios ...
- kvm虚似机监控
[root@ok Desktop]# yum install virt-top [root@ok Desktop]# virt-top virt-top 22:53:44 - x86_64 4/4CP ...
- grep -w
[root@86 ~]# mysqladmin -uroot -p123456 -S /tmp/mysql.sock extended-status|grep -w "Com_update& ...
- 使用jquery制作可视化的组织结构
组织结构是做项目里面经常用到的,但是要做成可视化的效果比较少,多数使用树结构来表示,但是对于客户来说不是太直观.可以用jOrgChart来实现.如下图的效果,这样就比较直观. 首先你要去下载jOrgC ...
- Linux下如何查找可执行文件
Linux下的可执行文件 Linux下如何查找可执行文件,作为一个Linux小菜刚刚有了这个问题, 在windows中,可以通过后缀名判断是否是可执行文件,比如.exe,.bat等是可执行文件,但是在 ...
- 使用HtmlAgilityPack抓取网页数据
XPath 使用路径表达式来选取 XML 文档中的节点或节点集.节点是通过沿着路径 (path) 或者步 (steps) 来选取的. 下面列出了最有用的路径表达式: nodename:选取此节点的所有 ...
- jquery 展开折叠菜单
jquery 展开折叠菜单 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <ht ...
- 谈敏捷,谈开发 --《Agile Software Development》读后感
谈敏捷,谈开发 --<Agile Software Development>读后感 北航计算机学院 110616班 11061171 毛宇 联系方式:maoyu815930@sina.co ...
- C语言位运算详解(转载)
转载自:http://www.cnblogs.com/911/archive/2008/05/20/1203477.html 位运算是指按二进制进行的运算.在系统软件中,常常需要处理二进制位的问题.C ...