spring容器 的启动过程
(2010-07-20 15:06:33)
标签:
spring启动过程杂谈 |
分类: java和数据库 |
什么时候spring容器启动?
其实就是程序中执行加载 xml配置文件的时候
ontext("testspring2.xml");
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-hibernate-mysql.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
可以看日志,每次执行new ClassPathXmlApplicationContext(),都会显示下面日志:
其实就是程序中执行加载 xml配置文件的时候
- 1.应用程序下加载
- 2.web模式下加载
可以看日志,每次执行new ClassPathXmlApplicationC
| 程序执行到: new ClassPathXmlApplicationC |
| 2010-5-29 0:48:48
org.springframework.context.support.AbstractApplicationConte 先刷新ApplicationContext,调用AbstractApplicationConte 注: AbstractApplicationConte |
| 信息: Refreshing
org.springframework.context.support.ClassPathXmlApplicationC |
| 2010-5-29 0:48:48
org.springframework.beans.factory.xml.XmlBeanDefinitionReader
loadBeanDefinitions 信息: Loading XML bean definitions from class path resource [testspring.xml] 开始加载spring配置文件,调用xml.XmlBeanDefinitionReader类的loadBeanDefinitions方法进行加载 注意:spring 和 hibernate 常见的错误之一,经常在读取xml文件时出现语法和格式的错误,如DTD错误等.多数是使用者自己在书写xml时犯的语法错误,但也有一些是hibernate和 spring不同版本的BUG |
| 2010-5-29 0:48:48
org.springframework.context.support.AbstractApplicationConte 信息: Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationC 2010-5-29 0:48:48 org.springframework.beans.factory.support.DefaultListableBeanFacto 获得缺省的工厂对象,spring缺省的工厂对象是 DefaultListableBeanFacto |
| 信息: Pre-instantiating singletons in
org.springframework.beans.factory.support.DefaultListableBeanFacto 最后为所有xml文件中定义(以及采用标注方式定义)的bean建立实例 |

加载中…