@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)
当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »