首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

从日记看Spring启动过程

2012-09-12 
从日志看Spring启动过程信息: Initializing Spring FrameworkServlet dispatcher15:07:34,015INFO Dispa

从日志看Spring启动过程

信息: Initializing Spring FrameworkServlet 'dispatcher'15:07:34,015  INFO DispatcherServlet:277 - FrameworkServlet 'dispatcher': initialization started15: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@18c56d15: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@c063ad15: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@15fc40c15: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 VelocityEngine15:07:34,375  INFO DispatcherServlet:296 - FrameworkServlet 'dispatcher': initialization completed in 360 ms2011-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 楼 luoyexian 2011-11-21   你好:请问web.xml 要怎么配置这两个文件,我将这两个文件放到web-info/spring 这及目录下。我写的配置是这样。
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath*:**/spring/*bean*.xml
</param-value>
</context-param>
<!--
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
-->
<!--  Spring MVC 的Servlet,它将加载WEB-INF/spring/spring-mvc.xml 的 配置文件,以启动Spring MVC模块-->
    <servlet>
        <servlet-name>springmvc</servlet-name>
        <servlet-class>
        org.springframework.web.servlet.DispatcherServlet
        </servlet-class>
        <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>>
        classpath*:**/spring/*mvc*.xml
        </param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
但报parsing XML document from ServletContext resource的错误。谢谢

热点排行