自定扫描路径下边带有@Controller,@Service,@Repository,@Component注解加入spring容器
通过includeFilters加入扫描路径下没有以上注解的类加入spring容器
通过excludeFilters过滤出不用加入spring容器的类
自定义增加了@Component注解的注解方式
1、 @ComponentScan注解是什么
其实很简单,@ComponentScan主要就是定义扫描的路径从中找出标识了需要装配的类自动装配到spring的
2、 @ComponentScan注解的详细使用
做过web开发的同学一定都有用过@Controller,@Service,@Repository注解,查看其源码你会发现,他们中有一个共同的注解@Component,没错@ComponentScan注解默认就会装配标识了@Controller,@Service,@Repository,@Component注解的类到spring容器中