<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 分析的更多相关文章

  1. [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 ...

  2. Context源码分析

    我们做安卓开发,时时都在和Context打交道,那么Context到底是什么?有什么作用?如何与Application,Activity,Service等实例发生联系的?等等 Context是什么? ...

  3. get****Context各个方法分析

    1 getApplicationContext分析 该方法为contextImpl类的方法,返回一个ApplicationContext.方法代码为: public Context getApplic ...

  4. go context 源码分析

    WithCancel func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { c := newCancelCtx(pare ...

  5. SGA: allocation forcing component growth分析

    1.问题现象 20年12月31日,数据库应用人员反映2020-12-31 12:40:10存在告警,过了几分钟之后业务恢复正常. 表现的状态:Connect to database time out, ...

  6. yii2 源码分析 Component类分析 (二)

    转载请注明链接http://www.cnblogs.com/liuwanqiu/p/6739538.html 组件(component),是Yii框架的基类,实现了属性.事件.行为三类功能,它集成自o ...

  7. android中LayoutInflater.from(context).inflate的分析

    在应用中自定义一个view,需要获取这个view的布局,需要用到 (LinearLayout) LayoutInflater.from(context).inflate(R.layout.conten ...

  8. SpringBoot自动配置(装配)流程

    源码分析 SpringBoot自动配置流程 ​ ​ 首先,我们要了解在@SpringBootApplication注解的内部,还具有@EnableAutoConfiguration,@SpringBo ...

  9. spring boot2.0

    1. Spring boot 简介 1.1 spring boot的三大特性 组件自动装配:Web mvc, Web Flux,JDBC等 激活:@EnableAutoConfiguration 配置 ...

  10. RESTful Demo

    Demo 功能 两个模块, App 与 Admin, App 模块提供增加用户(/add?name=${name})与查询用户(/query/${id}), Admin 模块提供列出所有用户(/lis ...

随机推荐

  1. HTTP协议的几个概念

    http://www.rupeng.com/favicon.ico 可获取当前图标favicon.ico服务器是指定文件名,不能更改一.HTTP协议的几个概念1.连接(Connection):浏览器和 ...

  2. WW_TRANS_I18N_LOCALE”与“WW_TRANS_I18N_LOCALE”属性

    Struts2 i18n国际化(允许用户自行选择语言)转最近在学习struts2,学习资料是李刚著的<struts2权威指南>,这本书写得非常好,非常有学习价值.我在学习过程中,自己跟着做 ...

  3. SQL 查询45题

    表格代码 create table student ( sno ) primary key, sname ) not null, ssex ) not null, sbirthday datetime ...

  4. 分布式系统唯一ID生成方案汇总

    系统唯一ID是我们在设计一个系统的时候常常会遇见的问题,也常常为这个问题而纠结.生成ID的方法有很多,适应不同的场景.需求以及性能要求.所以有些比较复杂的系统会有多个ID生成的策略.下面就介绍一些常见 ...

  5. Asp.net MVC中提交集合对象,实现Model绑定(转载)

    Asp.net MVC中的Model自动绑定功能,方便了我们对于request中的数据的处理, 从客户端的请求数据,自动地以Action方法参数的形式呈现.有时候我们的Action方法中想要接收数组类 ...

  6. Wordpress模板制作、改造、设计

    如何定义index.php以及如何派生出其它文件,在index.php文件中,在body元素内,新建如下结构化标记元素,各元素都带有不同的id属性: <div id=”page”> < ...

  7. 【codevs1993】草地排水 最大流

    [codevs1993]草地排水 题目描述 Description 在农夫约翰的农场上,每逢下雨,Bessie最喜欢的三叶草地就积聚了一潭水.这意味着草地被水淹没了,并且小草要继续生长还要花相当长一段 ...

  8. cocos2dx游戏开发——微信打飞机学习笔记(七)——Enemy的搭建

    一.文件创建~ Enemy.h Enemy.cpp 二.How to do? 由于我是已经完成成个游戏的功能,所以我会将游戏中enemy所需要的很多功能基本上都先考虑到了,如果大家自己在做的时候也许没 ...

  9. Hierarchy视图里的Transform和Camera组件

    Hierarchy视图里的Transform和Camera组件 在Hierarchy视图里,选中Camera,然后在Inspector视图里查看其各组件,如图1-8所示.对于Transform和Cam ...

  10. [LintCode] Find the Weak Connected Component in the Directed Graph

      Find the number Weak Connected Component in the directed graph. Each node in the graph contains a ...