【发布时间】:2017-03-14 05:39:07
【问题描述】:
我正在尝试将基于 Rest 的 Web 服务应用程序部署到 Weblogic 控制台 12C 上。为此,我使用了 Spring-Jersey 实现和 Spring 依赖注入。
在尝试访问我的服务时,我必须使用 Weblogic 的 /resources/* 路径,因为 /rest/* 不起作用。此外,SpringServlet 没有被调用,但 Weblogic 自己的 JAX-RS Jersey 实现正在运行。我已经检查过,在应用程序启动期间,spring 会正确创建 bean。
谁能提供一个关于如何使用我的实现而不是 Weblogic 的默认 JAX-RS 解决方案的解决方案。
web.xml。
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>TestWeb</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:testWebContext.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
<servlet>
<servlet-name>jersey</servlet-name>
<servlet-class>
com.sun.jersey.spi.spring.container.servlet.SpringServlet
</servlet-class>
<init-param>
<param-name>POJOMappingFeature</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.test.web.service</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jersey</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
testWebContext.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean id="testWebService" class="com.test.web.service.TestWebServiceImpl">
<property name="testWebBo" ref="testWebBo"/>
</bean>
<bean id="testWebBo" class="com.test.web.bo.TestWebBOImpl"/>
<bean name="destReader" init-method="readDestinations" class="com.test.web.util.DestinationReader"/>
</beans>
【问题讨论】:
标签: java web-services rest jersey weblogic12c