`
tonyan416
  • 浏览: 29233 次
  • 性别: Icon_minigender_1
  • 来自: 大连
社区版块
存档分类
最新评论

include-filter和exclude-filter

阅读更多
  最近仔细看看项目中的代码,发现一直在做项目,就是想着怎么去实现,剩下的东西基本都没注意看。结果到面试的时候我才发现这会是一件很悲剧的事情。所以痛定思痛,回过头来看看细节,只要现在开始,还不算晚.
 
<context:include-filter>和<context:exclude-filter>各代表引入和排除的過濾
 
  在主容器中(applicationContext.xml),看到
 
<!-- 使用annotation 自动注册bean,并保证@Required,@Autowired的属性被注入 -->
<context:component-scan base-package="cn.tonyan.tonyan.web" >
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
 
  很是奇怪为什么会是 exclude. 然后在(spring-mvc.xml),看到
<!-- 自动扫描且只扫描@Controller -->
<context:component-scan base-package="cn.tonyan.tonyan.web" use-default-filters="false">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>


  那为什么会是这样配置呢?
  原来因为会用到springmvc.xml 所以就会有父子容器的概念了.
  applicationcontext.xml是父容器,而springmvc.xml是子容器.
  在父容器中排除不扫描,在子容器中扫描,这样就避免了冲突.
 
 
引用
因为spring的context是父子容器,所以会产生冲突,Controller会进步前辈行扫描装配,而此时的Service还没有进行事务的加强处理惩罚,获得的将是原样的Service(没有经过事务加强处理惩罚,故而没有事务处理惩罚才能) ,最后才是applicationContext.xml中的扫描设备进行事务处理惩罚
 
分享到:
评论

相关推荐

    include-exclude:multimatch 的包装器提供了包含和排除模式

    提供最终用户友好的include和exclude模式数组。 针对工具/库开发人员。 用法 var includeExclude = require ( 'include-exclude' ) ; function filteredUtilityFunction ( opts ) { filter = includeExclude ( ...

    fsearch.tar_fsearch_wildcard_

    ## Features- Instant (as you type) results- Wildcard support- RegEx support- Filter support (only search for files folders or everything)- Include and exclude specific folders to be indexed- Ability ...

    transform-filter

    npm install transform-filter用法暂停您的怀疑,并假装没有过滤文件本身: var filterCoffee = filterTransform ( coffeeify , { include : [ '**/*.coffee' ] , // only run transform on matching files exclude ...

    lovelace-auto-entities::small_blue_diamond:自动填充lovelace卡的实体列表

    include : - &lt;filter&gt; - &lt;filter&gt; exclude : - &lt;filter&gt; - &lt;filter&gt; show_empty : unique : sort : 选项 card:必填。 要显示的卡。 可以像指定任何普通的lovelace卡一样指定它,但是省略entities:参数。 ...

    PowerShell脚本性能优化技巧总结

    所以,如果你使用的Cmdlet命令支持-Filter, -Include, 和 -Exclude这样的过滤条件,就尽量使用它们。 首先如果一条命令支持-Filter 过滤器参数,那就说明这里可能隐藏着一个对象访问API。使用过滤,可能会让代码执行...

    FreeFileSync

    Filter functionality to include/exclude files from synchronization (without requiring a re-compare!). Include/exclude specific files from synchronization temporarily. Create sync jobs via GUI to ...

    tfilter:使用glob或过滤器功能选择性地运行browserify转换

    browserify -t [ tfilter --exclude '**/*.json' envify --NODE_ENV production ] browserify ( ) . transform ( tfilter ( brfs , { include : '*.js' } ) , { /* options for brfs */ } ) . transform ( ...

    files-filters:文件过滤功能

    var files = require ( 'filter-files' ) ; var exclude = filters . exclude ( / node_modules / ) ; var include = filters . include ( / jscomments / , 'dirname' ) ; console . log ( files . sync ( 'node_...

    EurekaLog_7.5.0.0_Enterprise

    EurekaLog 7.5 (18-August-2016) 1)..Important: Installation layout was changed. All packages now have version suffix (e.g. EurekaLogCore240.bpl). No files are copied to \bin folder of IDE....

    端口查看工具

    o Added more include/exclude filter options in the context menu of CurrPorts. * Version 1.80: o Added custom log line option (In 'Advanced Options' window), which allows you to set the format of ...

    Linux下的rar解压缩工具

    e[+]&lt;attr&gt; Set file exclude and include attributes ed Do not add empty directories en Do not put 'end of archive' block ep Exclude paths from names ep1 Exclude base directory from names ep3 ...

    OutlookAttachView v2.73

    to the folders/subjects/from/to include/exclude lists. * Version 2.05 o Added 'Skip Exchange public folders' option. * Version 2.00 o Added command-line options to change any configuration value....

    simple-tags

    * Fix a bug with limit days/category filter for tag cloud. * Fix javascript autocomplete for allow enter new tag. * Re-add list of tags on manage page. * Version 1.7.4.4 : * Fix a stupid during ...

    Fastcopy(快速拷贝专家)1.8

    Include/Exclude Filter (UNIX Wildcard style) can be specified. It operates lightly because MFC is not used, and it makes it only from Win32 API. Because all source codes have been opened to the...

    Cornerstone_2.7.18 破解补丁(Mac)

    • Include and exclude files • Commit changes to folder properties without including nested files • Compare files without leaving commit view Branching and Merging: • Dedicated View for tagging ...

    正则表达式手册 常用模式解析(6)

    此为教程笔记 ...感谢老师:城市数据团大鹏 1.正则表达式快速上手 1.1 正则表达式是什么? 1.2 爬虫中正则表达式的作用是什么 2 正则表达式的模式 ...简单理解,就是原来表示转义字符的不再表示转义,而就是它原来的意思...

    FastCopy 源代码

    Include/Exclude Filter (UNIX Wildcard style) can be specified. &lt;br&gt; &lt;br&gt;It operates lightly because MFC is not used, and it makes it only from Win32 API. &lt;br&gt;Because all source codes have ...

    GetWebPics专业版2.9

    For instance, size filters (width, height), URL filters (include, exclude substrings), address name filter (name wildcard) and others. With GetWebPics you can download various types of pictures, ...

    elasticstore:Firebase CloudFirestore + ElasticSearch之间的可插入联合

    每个文档的transform , filter , include , exclude和mapping功能 通过Firebase完全与客户端通信(无需Elasticsearch客户端,尽管建议使用查询生成器) 清理旧的请求 受的实时数据库实施(Flashlight)启发 注意...

    C++网络爬虫项目

    根据配置文件的INCLUDE_PREFIXES和EXCLUDE_PREFIXES配置项,对被抓取 超链接的前缀进行限制。 2.4.3. 超文本传输协议响应包头过滤器插件(HeaderFilter) 根据配置文件的ACCEPT_TYPE配置项,对超文本传输协议响应的...

Global site tag (gtag.js) - Google Analytics