@ServletComponentScan ,@ComponentScan,@Configuration 解析

1,@ServletComponentScan

在SpringBoot的main方法上使用@ServletComponentScan注解后,Servlet、Filter、Listener可以直接通过@WebServlet、@WebFilter、@WebListener注解自动注册,无需其他代码。

2,@ComponentScan

包扫描会扫描只要标注了@Controller,@Service,@Repository,@Component这四个注解都会被扫描到容器中。

3,@Configurati

说明这是个配置文件,和原来xml配置是等效的,只不过现在用java代码进行配置了 加上一个@Configuration注解就行了

on

猜你喜欢

转载自www.cnblogs.com/xiaohu1218/p/10800790.html
今日推荐