<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. July 29th, Week 31st Friday, 2016

    I am a slow walker, but I never walk backwards. 我走得很慢,但我从来不会后退. I had run very fast, and I had once ...

  2. WebStorm设置字体和颜色

    新建Scheme + 修改字体 ctrl+alt+s打开Settings界面,Editor > Colors&Fonts > Font. Default scheme是亮色调,但我 ...

  3. Action返回类型

    1.返回ascx页面return PartialView(); 2.Content(),返回文本ContentResultreturn Content("这是一段文本"); 3.J ...

  4. (十)stm32中FSMC的使用(用于LCD)

    FSMC全称“静态存储器控制器”. 使用FSMC控制器后,可以把FSMC提供的FSMC_A[25:0]作为地址线,而把FSMC提供的FSMC_D[15:0]作为数据总线. (1)当存储数据设为8位时, ...

  5. LeetCode之Min Stack 实现最小栈

    LeetCode相关的网上资源比较多,看到题目一定要自己做一遍,然后去学习参考其他的解法. 链接: https://oj.leetcode.com/problems/min-stack/ 题目描述: ...

  6. device unauthorized & ANDROID_ADB_SERVER_PORT 问题解决

    最近做安卓开发的时候,碰到了如下两个极品问题,刚开始晕头转向,仔细一研究终于解决了: FAQ1: C:\Users\xxx>adb shelladb: Env var ANDROID_ADB_S ...

  7. 随机sample文件Python程序

    经常遇到由于样本巨大,需要sample一部分文件进行案例分析的情况,下面的程序主要为了随机抽取一个大文件中的N行. #!/usr/bin/python # -*- coding: <encodi ...

  8. CF 149D Coloring Brackets 区间dp ****

    给一个给定括号序列,给该括号上色,上色有三个要求 1.只有三种上色方案,不上色,上红色,上蓝色 2.每对括号必须只能给其中的一个上色 3.相邻的两个不能上同色,可以都不上色 求0-len-1这一区间内 ...

  9. 建模算法(六)——神经网络模型

    (一)神经网络简介 主要是利用计算机的计算能力,对大量的样本进行拟合,最终得到一个我们想要的结果,结果通过0-1编码,这样就OK啦 (二)人工神经网络模型 一.基本单元的三个基本要素 1.一组连接(输 ...

  10. python list append方法

    keyValueResult = {'a': 1, 'b': 2} sendData = [] def set_push_format(ip): data_format = { "endpo ...