不同子类会做不同的事情。下面将以Springboot启动是到的
AnnotationConfigServletWebServerApplicationContext来做分析。
比如 :AnnotationConfigServletWebServerApplicationContext.class
会进行包的扫描和一些类信息的加载、因为此类在前面没有做这一块。
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
super.postProcessBeanFactory(beanFactory);
if (this.basePackages != null && this.basePackages.length > 0) {
this.scanner.scan(this.basePackages);
}
if (!this.annotatedClasses.isEmpty()) {
this.reader.register(ClassUtils.toClassArray(this.annotatedClasses));
}
}