泽西岛的“默认applicationContext”是什么?

时间:2013-02-06 22:09:25

标签: spring jersey

我正在使用Jersey对RESTful Web服务执行验收测试。看起来好像我的applicationContext.xml在客户端加载时没有被加载。我看到以下日志输出:

INFO: Using default applicationContext 

这是“默认”文件soemthing,当它找不到我的文件时加载?或者这是否表明我的文件被找到了?

@ContextConfiguration(locations={"/applicationContext.xml", "/applicationContextTest.xml"})
public class BaseResourceTest extends JerseyTest {

    final static URI baseUri = UriBuilder.fromUri( "http://localhost" ).port( 9998 ).build();

    public BaseResourceTest() throws Exception {        
        super(new WebAppDescriptor.Builder("xxx.yyy.zzz").contextPath(baseUri.getPath())
                .contextParam(
                    SpringServlet.CONTEXT_CONFIG_LOCATION, "classpath:applicationContextTest.xml" )
                .servletClass(SpringServlet.class )
                .contextListenerClass( ContextLoaderListener.class )                
                .build());
    }

.......
some tests
.......

}

我的web.xml:

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:applicationContext.xml</param-value>
</context-param>

<listener>
    <listener-class>xxx.yyy.LoggingAssuranceListener</listener-class>
</listener>

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

<servlet>
    <servlet-name>jersey-servlet</servlet-name>
    <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
    <init-param>
        <param-name>com.sun.jersey.config.property.packages</param-name>
        <param-value>xxx.yyy.zzzz</param-value>
    </init-param>
    <init-param>
        <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
        <param-value>true</param-value>
    </init-param>
    <init-param>
         <param-name>com.sun.jersey.config.property.WadlGeneratorConfig</param-name>
         <param-value>xxx.yyy.zzz.BroadsoftWadlGeneratorConfig</param-value>
    </init-param> 
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>jersey-servlet</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

0 个答案:

没有答案