当前位置:首页 > Spring > 正文内容

spring 源码解读

淙嶙7年前 (2018-08-23)Spring935
>org.springframework.web.context.ContextLoaderListener#contextInitialized
  >org.springframework.web.context.ContextLoader#initWebApplicationContext
    >org.springframework.web.context.ContextLoader#createWebApplicationContext
    >org.springframework.web.context.ContextLoader#configureAndRefreshWebApplicationContext

//创建WebApplicationContext(Xml)
>org.springframework.web.context.ContextLoader#createWebApplicationContext
  >org.springframework.web.context.ContextLoader#determineContextClass
    >java.util.Properties#getProperty(java.lang.String) 
    >org.springframework.web.context.support.XmlWebApplicationContext
 //   
>org.springframework.web.context.ContextLoader#configureAndRefreshWebApplicationContext
  >javax.servlet.ServletContext#getInitParameter  classpath:spring-application.xml,classpath:spring-dao.xml,classpath:spring-dubbo-provider.xml
  >org.springframework.context.support.AbstractRefreshableConfigApplicationContext#setConfigLocation//存放配置文件路径到configLocations

  >org.springframework.context.ConfigurableApplicationContext#refresh
    >org.springframework.context.support.AbstractApplicationContext#prepareRefresh
      >org.springframework.web.context.support.AbstractRefreshableWebApplicationContext#initPropertySources
        >org.springframework.web.context.support.StandardServletEnvironment#initPropertySources
          >org.springframework.web.context.support.WebApplicationContextUtils#initServletPropertySources(org.springframework.core.env.MutablePropertySources, javax.servlet.ServletContext, javax.servlet.ServletConfig)

    >org.springframework.context.support.AbstractApplicationContext#obtainFreshBeanFactory
      >org.springframework.context.support.AbstractRefreshableApplicationContext#refreshBeanFactory
        >org.springframework.context.support.AbstractRefreshableApplicationContext#createBeanFactory  org.springframework.beans.factory.support.DefaultListableBeanFactory
        >org.springframework.context.support.AbstractRefreshableApplicationContext#loadBeanDefinitions
          >org.springframework.context.support.AbstractXmlApplicationContext#loadBeanDefinitions(org.springframework.beans.factory.support.DefaultListableBeanFactory)
            >org.springframework.web.context.support.XmlWebApplicationContext#loadBeanDefinitions(org.springframework.beans.factory.xml.XmlBeanDefinitionReader)
              >org.springframework.web.context.support.AbstractRefreshableWebApplicationContext#getConfigLocations //配置文件都在这里(spring*.xml)[循环加载资源文件]
              >org.springframework.beans.factory.support.AbstractBeanDefinitionReader#loadBeanDefinitions(java.lang.String)
                >org.springframework.beans.factory.support.AbstractBeanDefinitionReader#loadBeanDefinitions(java.lang.String, java.util.Set<org.springframework.core.io.Resource>)
                  >org.springframework.core.io.support.ResourcePatternResolver#getResources  //class path resource [spring-application.xml]
                  >org.springframework.beans.factory.support.AbstractBeanDefinitionReader#loadBeanDefinitions(org.springframework.core.io.Resource...)
                    >org.springframework.beans.factory.support.BeanDefinitionReader#loadBeanDefinitions(org.springframework.core.io.Resource)
                      >org.springframework.beans.factory.xml.XmlBeanDefinitionReader#loadBeanDefinitions(org.springframework.core.io.support.EncodedResource)
                        >org.springframework.beans.factory.xml.XmlBeanDefinitionReader#doLoadBeanDefinitions
                          >org.springframework.beans.factory.xml.XmlBeanDefinitionReader#registerBeanDefinitions
                            >org.springframework.beans.factory.xml.BeanDefinitionDocumentReader#registerBeanDefinitions
                              >org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader#doRegisterBeanDefinitions
                                >org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader#parseBeanDefinitions
                                  >org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader#parseDefaultElement
                                  >org.springframework.beans.factory.xml.BeanDefinitionParserDelegate#parseCustomElement(org.w3c.dom.Element)
                                    >org.springframework.beans.factory.xml.NamespaceHandlerSupport#findParserForElement

                                    >org.springframework.beans.factory.xml.AbstractBeanDefinitionParser#parse
                                      >org.springframework.context.annotation.AnnotationConfigBeanDefinitionParser#parse
                                        >org.springframework.context.annotation.AnnotationConfigUtils#registerAnnotationConfigProcessors(org.springframework.beans.factory.support.BeanDefinitionRegistry, java.lang.Object)
                                        >org.springframework.beans.factory.xml.ParserContext#registerComponent

                                        >org.springframework.beans.factory.xml.AbstractBeanDefinitionParser#parseInternal  //properties文件  
                                          >org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser#doParse(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext, org.springframework.beans.factory.support.BeanDefinitionBuilder)
                                            >org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser#doParse(org.w3c.dom.Element, org.springframework.beans.factory.support.BeanDefinitionBuilder)

                                      >org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser#parseInternal
                                        >org.springframework.context.config.PropertyPlaceholderBeanDefinitionParser#doParse
                                          >org.springframework.context.config.AbstractPropertyLoadingBeanDefinitionParser#doParse //properties文件 

                                      >org.springframework.beans.factory.xml.AbstractBeanDefinitionParser#registerBeanDefinition
                                        >org.springframework.beans.factory.support.BeanDefinitionReaderUtils#registerBeanDefinition
                                           >org.springframework.beans.factory.support.DefaultListableBeanFactory#registerBeanDefinition

                                      >org.springframework.beans.factory.xml.ParserContext#registerComponent

                >org.springframework.context.annotation.ComponentScanBeanDefinitionParser#parse
                  >org.springframework.context.annotation.ClassPathBeanDefinitionScanner#doScan
                    >org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider#findCandidateComponents
                      >org.springframework.core.io.support.ResourcePatternResolver#getResources  \获取所有配置在scan扫描路径下的文件
                      >将@Service @Companment 的类 放入ScannedGenericBeanDefinition 存入candidates.
                    >org.springframework.context.annotation.AnnotationConfigUtils#processCommonDefinitionAnnotations(org.springframework.beans.factory.annotation.AnnotatedBeanDefinition)

                    >org.springframework.context.annotation.ClassPathBeanDefinitionScanner#registerBeanDefinition this.beanDefinitionMap.put(beanName, beanDefinition) this.beanDefinitionNames.add(beanName);  this.manualSingletonNames.remove(beanName);

相关文章

Spring WebFlux WebSocket 推送

Spring WebFlux WebSocket 推送

关于websocket的资料一大堆,但是关于webflux websocket的有用的太少了,由于项目中需要使用,花了几天时间终于搞通了,今天把主要关于推送的部分总结出来,便于以后参考 1. 服务端...

SpringMVC通过url请求到Controller的过程

SpringMVC通过url请求到Controller的过程

>org.springframework.web.servlet.FrameworkServlet#doGet >org.springframework.web.servlet.Fr...

springboot分页-及问题排查

springboot分页-及问题排查

1.正常流程引入依赖jar包 <dependency> <groupId>com.github.pagehelper</groupId> <...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。