1

我正在用 Spring 构建一个 GWT 应用程序。我在将依赖项注入到我的一个 Servlet 时遇到了一些问题,因此我试图缩小可能出现问题的范围。

首先,当我的应用程序启动时,我得到:

[WARN] 服务器类 'org.springframework.web.context.ContextLoaderListener' 在 Web 应用程序中找不到,但在系统类路径中找到
[WARN] 添加类路径条目 'file:/home/macarse/.m2/repository /org/springframework/spring/2.5.6/spring-2.5.6.jar' 到此会话的 Web 应用程序类路径有关更多信息,请参阅:file:/home/macarse/tpf/eclipse/plugins/com.google.gwt .eclipse.sdkbundle.2.0.4_2.0.4.v201006301309/gwt-2.0.4/doc/helpInfo/webAppClassPath.html [警告]在web 应用程序,但在系统类路径中找到
[警告] 添加类路径条目'file:/home/macarse/tpf/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.2.0.4_2.0.4.v201006301309/gwt-2.0.4/gwt-dev.jar'到此会话的 Web 应用程序类路径有关其他信息,请参阅:file:/home/macarse/tpf/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.2.0.4_2.0.4.v201006301309/gwt-2.0.4/ doc/helpInfo/webAppClassPath.html 2010 年 7 月 18 日上午 11:07:00 org.springframework.web.context.ContextLoader initWebApplicationContext 信息:根 WebApplicationContext:初始化开始于 2010 年 7 月 18 日上午 11:07:00 org.springframework.context。 support.AbstractApplicationContext prepareRefresh INFO:刷新 org.springframework.web.context.support.XmlWebApplicationContext@16b904d:显示名称 [Root WebApplicationContext];启动日期 [Sun Jul 18 11:07:00 ART 2010];上下文层次结构的根 2010 年 7 月 18 日上午 11:07:00 org.springframework.context.support.AbstractApplicationContext 获得FreshBeanFactory 信息:应用程序上下文的 Bean 工厂 [org.springframework.web.context.support.XmlWebApplicationContext@16b904d]:org.springframework .beans.factory.support.DefaultListableBeanFactory@1a8dfb3 2010 年 7 月 18 日上午 11:07:01 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons 信息:在 org.springframework.beans.factory.support.DefaultListableBeanFactory 中预实例化单例@1a8dfb3:定义 bean [];工厂层次结构的根 2010 年 7 月 18 日上午 11:07:01 org.springframework.web.context.ContextLoader initWebApplicationContext AbstractApplicationContext 获得FreshBeanFactory 信息:应用程序上下文的 Bean 工厂 [org.springframework.web.context.support.XmlWebApplicationContext@16b904d]:org.springframework.beans.factory.support.DefaultListableBeanFactory@1a8dfb3 Jul 18, 2010 11:07:01 AM org. springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons INFO:在 org.springframework.beans.factory.support.DefaultListableBeanFactory@1a8dfb3 中预实例化单例:定义 beans []; 工厂层次结构的根 2010 年 7 月 18 日上午 11:07:01 org.springframework.web.context.ContextLoader initWebApplicationContext AbstractApplicationContext 获得FreshBeanFactory 信息:应用程序上下文的 Bean 工厂 [org.springframework.web.context.support.XmlWebApplicationContext@16b904d]:org.springframework.beans.factory.support.DefaultListableBeanFactory@1a8dfb3 Jul 18, 2010 11:07:01 AM org. springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons INFO:在 org.springframework.beans.factory.support.DefaultListableBeanFactory@1a8dfb3 中预实例化单例:定义 beans []; 工厂层次结构的根 2010 年 7 月 18 日上午 11:07:01 org.springframework.web.context.ContextLoader initWebApplicationContext DefaultListableBeanFactory@1a8dfb3 2010 年 7 月 18 日上午 11:07:01 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons 信息:在 org.springframework.beans.factory.support.DefaultListableBeanFactory@1a8dfb3 中预实例化单例:定义 bean [] ; 工厂层次结构的根 2010 年 7 月 18 日上午 11:07:01 org.springframework.web.context.ContextLoader initWebApplicationContext DefaultListableBeanFactory@1a8dfb3 2010 年 7 月 18 日上午 11:07:01 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons 信息:在 org.springframework.beans.factory.support.DefaultListableBeanFactory@1a8dfb3 中预实例化单例:定义 bean [] ; 工厂层次结构的根 2010 年 7 月 18 日上午 11:07:01 org.springframework.web.context.ContextLoader initWebApplicationContext

那样可以么?

在我的web.xml我有:

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
        classpath*:/META-INF/spring-presentation.xml, classpath*:/META-INF/spring-persistence.xml
    </param-value>
</context-param>

有没有办法知道这两个 xml 是否已加载?

4

1 回答 1

1

扫描您的应用程序启动日志。您应该找到日志,告诉您它以以下格式加载了哪些上下文文件(日志模式可能因您的日志配置而异):

org.springframework.beans.factory.xml.XmlBeanDefinitionReader (315): 从 ServletContext 资源加载 XML bean 定义 [/META-INF/spring-presentation.xml]

org.springframework.beans.factory.xml.XmlBeanDefinitionReader (315): 从 ServletContext 资源加载 XML bean 定义 [/META-INF/spring-persistence.xml]

于 2010-07-19T23:05:00.740 回答