ITeye博客

从日志看Spring启动过程

ch_space · 2011-03-02 15:16 · Spring · 企业架构 · Markdown


信息: Initializing Spring root WebApplicationContext
15:07:33,078  INFO ContextLoader:189 - Root WebApplicationContext: initialization started
15:07:33,109  INFO XmlWebApplicationContext:411 - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@18c56d: display name [root webapplicationcontext]; startup date [wed mar 02 15:07:33 cst 2011]; root of context hierarchy
15:07:33,156  INFO XmlBeanDefinitionReader:323 - Loading XML bean definitions from ServletContext resource [/web-inf/beans.xml]
15:07:33,390  INFO XmlBeanDefinitionReader:323 - Loading XML bean definitions from ServletContext resource [/web-inf/mail.xml]
15:07:33,406  INFO XmlWebApplicationContext:426 - Bean factory for application context [org.springframework.web.context.support.xmlwebapplicationcontext@18c56d]: org.springframework.beans.factory.support.DefaultListableBeanFactory@15fc40c
15:07:33,500  INFO PropertyPlaceholderConfigurer:178 - Loading properties file from ServletContext resource [/web-inf/jdbc.properties]
15:07:33,500  INFO PropertyPlaceholderConfigurer:178 - Loading properties file from ServletContext resource [/web-inf/mail.properties]
15:07:33,562  INFO DefaultListableBeanFactory:414 - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@15fc40c: defining beans [favoritedao,messagedao,refcommentdao,referencedao,refrequestdao,sequencedao,userdao,daosupport,facade,mailfactory,mailtask,mailtaskfactory,org.springframework.context.annotation.internalcommonannotationprocessor,org.springframework.context.annotation.internalautowiredannotationprocessor,org.springframework.context.annotation.internalrequiredannotationprocessor,org.springframework.aop.config.internalautoproxycreator,org.springframework.transaction.annotation.annotationtransactionattributesource#0,org.springframework.transaction.interceptor.transactioninterceptor#0,org.springframework.transaction.config.internaltransactionadvisor,datasource,txmanager,sqlmapclient,sqlmapclienttmp,threadpool,cookiefilter,propertyconfigurer,mailsender,regmail,updatemail]; root of factory hierarchy
15:07:33,953  INFO ThreadPoolTaskExecutor:250 - Initializing ThreadPoolExecutor 'threadPool'
15:07:33,984  INFO ContextLoader:209 - Root WebApplicationContext: initialization completed in 906 ms
2011-3-2 15:07:34 org.apache.catalina.core.ApplicationContext log


信息: Initializing Spring FrameworkServlet 'dispatcher'
15:07:34,015  INFO DispatcherServlet:277 - FrameworkServlet 'dispatcher': initialization started
15:07:34,015  INFO XmlWebApplicationContext:411 - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@16477d9: display name [webapplicationcontext for namespace 'dispatcher-servlet']; startup date [wed mar 02 15:07:34 cst 2011]; parent: org.springframework.web.context.support.XmlWebApplicationContext@18c56d
15:07:34,015  INFO XmlBeanDefinitionReader:323 - Loading XML bean definitions from ServletContext resource [/web-inf/dispatcher-servlet.xml]
15:07:34,046  INFO XmlWebApplicationContext:426 - Bean factory for application context [org.springframework.web.context.support.xmlwebapplicationcontext@16477d9]: org.springframework.beans.factory.support.DefaultListableBeanFactory@c063ad
15:07:34,062  INFO DefaultListableBeanFactory:414 - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@c063ad: defining beans [checkcodecontroller,usercontroller,org.springframework.context.annotation.internalcommonannotationprocessor,org.springframework.context.annotation.internalautowiredannotationprocessor,org.springframework.context.annotation.internalrequiredannotationprocessor,velocityconfig,viewresolver,multipartresolver]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@15fc40c
15:07:34,093  INFO VelocityConfigurer:222 - Loading Velocity config from [servletcontext resource [/web-inf/velocity.properties]]
15:07:34,109  INFO VelocityConfigurer:138 - ClasspathResourceLoader with name 'springMacro' added to configured VelocityEngine
15:07:34,375  INFO DispatcherServlet:296 - FrameworkServlet 'dispatcher': initialization completed in 360 ms
2011-3-2 15:07:34 org.apache.coyote.http11.Http11Protocol start

注意两点:

1、Spring applicationContext先启动,servlet context后加载 2、dispatcher-servlet.xml中定义了控制器映射,使用Controller+RequestMapping注解映射时,相关controller组件扫描要定义在dispatcher-servlet.xml中,而非applicationContext.xml中。

评论(1)

  1. #1 楼 · luoyexian · 2011-11-21 15:35

    你好:请问web.xml 要怎么配置这两个文件,我将这两个文件放到web-info/spring 这及目录下。我写的配置是这样。 contextConfigLocation classpath*:/spring/bean.xml springmvc org.springframework.web.servlet.DispatcherServlet contextConfigLocation > classpath*:/spring/mvc.xml 1 但报parsing XML document from ServletContext resource的错误。谢谢

评论功能维护中,当前仅展示历史评论。