eg:

1、现在给定一个项目包的结构:

com.yk.controller

com.yk.service

2、在SpringMVC.XML有以下的配置:

《!--扫描@controller注解--》

<context:component-scan base-package="com.yk.controller">

<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" />

</context:component-scan>

把最终的包写上,而不能这样写base-package="com.yk"。这种写法对于:include-filter来讲它都会扫描。而不是仅仅扫描@controller

如果这样,一般会导致一个常见的错误---事务不起作用。解决的方法:添加:use-default-filters=”false”

2)<context:component-scan base-package="com.yk"> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" /> </context:component-scan>

这样的意思 不包括@controller

SpringMVC (<context:include-filter>和<context:exclude-filter>的使用)的更多相关文章

  1. Web.xml详解(转)(Filter,context,listener)

    web.xml 详细解释!!(链接) web.xml加载过程(步骤) 首先简单说一下,web.xml的加载过程. 当我们去启动一个WEB项目时,容器包括(JBoss.Tomcat等)首先会读取项目we ...

  2. Spring Security 入门(1-6-2)Spring Security - 内置的filter顺序、自定义filter、http元素和对应的filterChain

    Spring Security 的底层是通过一系列的 Filter 来管理的,每个 Filter 都有其自身的功能,而且各个 Filter 在功能上还有关联关系,所以它们的顺序也是非常重要的. 1.S ...

  3. 元素 "context:component-scan" 的前缀 "context" 未绑定的解决方案

    在动态web项目(Dynamic Web Project)中,使用SpringMVC框架,新建Spring的配置文件springmvc.xml,添加扫描控制器 <context:componen ...

  4. context:component-scan" 的前缀 "context" 未绑定。

    SpElUtilTest.testSpELLiteralExpressiontestSpELLiteralExpression(cn.zr.spring.spel.SpElUtilTest)org.s ...

  5. Android中,Context,什么是Context?

    注:本文翻译自Context, What Context?,原文链接在这里,作者是Dave Smith.ps:译者链接http://blog.csdn.net/race604/article/deta ...

  6. Android开发之Android Context,上下文(Activity Context, Application Context)

    转载:http://blog.csdn.net/lmj623565791/article/details/40481055 1.Context概念Context,相信不管是第一天开发Android,还 ...

  7. System.Drawing.Design.UITypeEditor自定义控件属性GetEditStyle(ITypeDescriptorContext context),EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.C ...

  8. Spring context:component-scan中使用context:include-filter和context:exclude-filter

    Spring context:component-scan中使用context:include-filter和context:exclude-filter XML: <?xml version= ...

  9. DirectX:在graph自己主动连线中增加自己定义filter(graph中遍历filter)

    为客户提供的视频播放的filter的測试程序中,採用正向手动连接的方式(http://blog.csdn.net/mao0514/article/details/40535791).因为不同的视频压缩 ...

  10. 关于Springmvc中include与Sitemesh装饰器的基本使用

    关于Springmvc中include与Sitemesh装饰器的使用 !!!转载请注明出处=>http://www.cnblogs.com/funnyzpc/p/7283443.html 静态包 ...

随机推荐

  1. read design into DC memory

  2. 【 android】When an app is installed on the external storage

    When an app is installed on the external storage: The .apk file is saved to the external storage, bu ...

  3. 【windows】【md5】查看文件的md5值

    certutil -hashfile filename MD5 certutil -hashfile filename SHA1 certutil -hashfile filename SHA256 ...

  4. python爬虫基础18-Chrome调试前端工具

    01 Chrome调试 抓包工具原理 Chrome 开发者工具是一套内置在Google Chrome中Web开发和调试工具.使用开发者工具来重演,调试和剖析您的网站. 其中常用的有Elements(元 ...

  5. 20181206(re,正则表达式,哈希)

    1.re&正则表达式 2.hashlib 一:re模块&正则表达式 正则:正则就是用一些具有特殊含义的符号组合到一起(称为正则表达式)来描述字符或者字符串的方法.或者说:正则就是用来描 ...

  6. Applied Nonparametric Statistics-lec5

    今天继续two-sample test Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/6 Mann ...

  7. NAT(地址转换技术)详解(转载)

    作者:逃离地球的小小呆 来源:CSDN 原文:https://blog.csdn.net/gui951753/article/details/79593307版权声明:本文为博主原创文章,转载请附上博 ...

  8. 【MySQL】MySQL基础

    一.基本语法 [MySQL目录结构]●bin目录,存储可执行文件●data目录,存储数据文件●docs,文档●include目录,存储包含的头文件●lib目录,存储库文件●share,错误信息和字符集 ...

  9. Python之log的处理方式

    配置文件: #! /usr/bin/env python # -*- coding: utf-8 -*- """ logging配置 """ ...

  10. 缓存淘汰算法之LRU实现

    Java中最简单的LRU算法实现,就是利用 LinkedHashMap,覆写其中的removeEldestEntry(Map.Entry)方法即可 如果你去看LinkedHashMap的源码可知,LR ...