宋子宪博客

Szx

@ComponentScan注解的属性详细使用
指定包扫描,主要扫描该包下@Controller @Service @Respsitory @Component四...
扫描右侧二维码阅读全文
06
2019/07

@ComponentScan注解的属性详细使用

指定包扫描,主要扫描该包下@Controller @Service @Respsitory @Component四个注解

@ComponentScan(value="com.songzixian")

指定排除要扫描的包

@ComponentScan(value="com.songzixian",excludeFilters ={@ComponentScan.Filter (type= FilterType.ANNOTATION,classes ={Component.class,Repository.class,Controller.class,Service.class})} )

指定要扫描的包
useDefaultFilters = false默认是true,需要改为false该类才生效

@ComponentScan(value="com.songzixian",includeFilters ={@ComponentScan.Filter (type= FilterType.ANNOTATION,classes ={Component.class,Repository.class,Controller.class,Service.class})},useDefaultFilters = false)
Last modification:July 6th, 2019 at 07:45 am
如果觉得这篇技术文章对您有帮助,可以请博主喝一杯饮料

Leave a Comment