说说springboot启动机制
2021-01-04 05:29
标签:correct for tty 老师 gets inf def div sel 说说springboot启动机制 通过@EnableAutoConfiguration 加载 看出它回到这个包的路径下读取这个spring.factories配置文件:重点看这个三个 org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration这个文件中,有启动Tomcat 老师的版本是2.0 本人这个org.springframework.boot.autoconfigure 的jar包是1.5.10... 启动tomcat如下代码 手写spirngboot ,启动验证 说说springboot启动机制 标签:correct for tty 老师 gets inf def div sel 原文地址:https://www.cnblogs.com/rogge7/p/12986405.html
https://ke.qq.com/webcourse/index.html#cid=333216&term_id=100395479&taid=2568313133929888&vid=5285890788262993749@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@SpringBootConfiguration
@EnableAutoConfiguration --->
@ComponentScan(
excludeFilters = {@Filter(
type = FilterType.CUSTOM,
classes = {TypeExcludeFilter.class}
), @Filter(
type = FilterType.CUSTOM,
classes = {AutoConfigurationExcludeFilter.class}
)}
)
public @interface SpringBootApplication {
@AliasFor(
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@AutoConfigurationPackage
@Import({EnableAutoConfigurationImportSelector.class}) //------>通过
public @interface EnableAutoConfiguration {
String ENABLED_OVERRIDE_PROPERTY = "spring.boot.enableautoconfiguration";
Class>[] exclude() default {};
String[] excludeName() default {};
}
@Import 把一个类通过这种方式交给Spring容器管理
@Import({EnableAutoConfigurationImportSelector.class}) 点进去看这个类,再看它的父类@Deprecated
public class EnableAutoConfigurationImportSelector extends AutoConfigurationImportSelector { protected List
WebMvcAutoConfiguration.java 文件中:主要通过enablewebmvc注解 把springmvc加载进来