问题描述:
------------------------------------------------
环境:Spring 4, Resteasy 3.0.6 and Tomcat 7
问题:所有的REST服务都是404错误
官方给出的解决方案:https://issues.jboss.org/browse/RESTEASY-1012
-------------------------------------------------
经过本人验证测试通过,改动如下:
1、在maven配置文件pom.xml中添加servlet3(spring4是基于servlet3为基准的)
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
2、重写ContextLoaderListener(自己实现)
import javax.servlet.ServletContext;
import org.jboss.resteasy.plugins.spring.SpringContextLoaderSupport;
import org.springframework.web.context.ConfigurableWebApplicationContext;
import org.springframework.web.context.ContextLoaderListener;
public class MyContextLoaderListener extends ContextLoaderListener {
private SpringContextLoaderSupport springContextLoaderSupport = new SpringContextLoaderSupport();
@Override
protected void customizeContext(ServletContext servletContext, ConfigurableWebApplicationContext configurableWebApplicationContext) {
super.customizeContext(servletContext, configurableWebApplicationContext);
this.springContextLoaderSupport.customizeContext(servletContext, configurableWebApplicationContext);
}
}
3、修改web.xml中的ContextLoaderListener
<!-- <listener>
<listener-class>org.jboss.resteasy.plugins.spring.SpringContextLoaderListener</listener-class>
</listener> -->
<listener>
<listener-class>com.xxx.xxx.MyContextLoaderListener</listener-class>
</listener>
ok,就改这3个地方就可以解决此404问题了!
分享到:
相关推荐
Spring整合RestEasy示例工程源码,Spring+Jetty+RestEasy
该项目为 Spring Boot 应用程序提供 RESTEasy 自动配置。入门构建此项目并将其安装到您的 Maven 存储库中: $ mvn install然后,您应该在应用程序的build.gradle或pom.xml添加对org.springframework.boot:spring-...
Resteasy + Spring + Netty sample Inject resteasy provider / controllers as spring bean Authentication Run at Main.java Test http://localhost:8082/resteasy/hello/world 教程 jax-rs规范用法: ...
RestEasy-3.09-Spring-3.2.5-Swagger2.0 Jboss EAP 6(Jboss 7)RestEasy 3.09 Spring 3.2.5 Swagger 2.0与Web.xml和Bean配置的Swagger UI集成 为此,您必须将RestEasy安装升级到3.09 说明来自: : Resteasy与...
POC 网址 Resteasy Jaxrs 1.0 Spring
另外,此RESTEasy Spring Boot启动程序将按预期方式与Spring集成,这意味着每个也是Spring Bean的JAX-RS REST资源都将被自动自动扫描,集成和可用。 产品特点 为Spring Boot应用程序启用RESTEasy 作为Spring bean...
resteasy-spring-netty Resteasy + Spring + Netty sample Inject resteasy provider / controllers as spring bean Authentication ===================== Run at Main.java Test 教程 jax-rs规范用法: resteasy ...
resteasy
任何想要具有REST端点并且更喜欢RESTEasy作为JAX-RS实现的常规Spring Boot应用程序都可以使用此Spring Boot启动器。 另外,此RESTEasy Spring Boot启动程序将按预期方式与Spring集成,这意味着每个也是Spring Bean...
宁静的春天 Resteasy + Spring + Netty示例 作为spring bean注入resteasy提供者/控制器 验证 ==================== 在Main.java中运行 测试
resteasy讲解
resteasy入门级文档、如何使用Restful进行WebService的开发简介及相关RestEasy相关资源的链接
resteasy简单demo使用的jar包
resteasy不使用tomcat使用netty实现,实现了高性能,也可以不需要tomcat的容器,一个主函数就能执行
详细描述了restEasy在servlet3.0前后的不同使用方法;restEasy 结合httpServer 无需容器开发;restEasy的通用差错拦截;附详细实现源码!
RESTEasy入门经典.docx
使用RESTEasy+guice实现上传下载文件
resteasy-jaxrs-2.3.2框架源码。希望您了解Resteasy框架有所帮助
该资源是java restful的应用框架resteasy---实现了jax-rs规范的一个demo,如有疑问请联系caizhh2009@gmail.com
RESTEasy JSON DEMO