1.springboot自动装配原理
(
1
)默认自动扫描的包 【主启动类所在的包以及子包】
@SpringBootApplication
@MapperScan(basePackages = {"com.springboot.mapper"})
//@ComponentScan(basePackages = {"com.springboot"}) //认为的指定扫描那些包
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
如果想扫描其他的包,则必须人为的指定。
@ComponentScan(basePackages = {"com.springboot"}) //认为的指定扫描那些包
(
2
)自动装配类。
web---AutoConfigurtionDispactherServlet---
自动装配
DispatcherServlet
类