context:include-filter与exclude-filte控制扫描组件
发布日期:2021-05-07 09:14:15 浏览次数:9 分类:原创文章

本文共 707 字,大约阅读时间需要 2 分钟。

context:include-filter与exclude-filte控制扫描组件

<!-- 扫描的时候排除一些不要的组件		type="annotation"按照注解进行排除,标了指定注解的组件不要			expression="":注解的全类名		type="assignable":指定排除某个具体的类,按照类排除				type="aspectj":aspectj表达式		type="custom":自动义TypeFilter,自己写代码确定哪些使用		type="regex":则正表达式	 -->	<context:component-scan base-package="com.atguigu">		<context:exclude-filter type="assignable" expression="com.atguigu.service.BookService"/>	</context:component-scan>		<!-- 只扫描进入哪些组件,默认都是全部扫描进来		use-default-filters="false:禁止默认规则,默认是全部扫描	 -->	 <context:component-scan base-package="com.atguigu" use-default-filters="false">	 	<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>	 </context:component-scan>
上一篇:spring注解自动装配
下一篇:Spring使用注解管理bean

发表评论

最新留言

很好
[***.229.124.182]2025年04月11日 23时52分51秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章