Using Jersey-spring with Spring 4.0

孤街浪徒 提交于 2019-11-28 21:00:43

问题


According to you what are the risks of using Spring 4 with the jersey-spring3 integration module?

I have tried to use Spring 4.0 with the jersey spring example and the example still works but i'm unable to identify risks linked to this usage.


回答1:


I have started using Jersey 2.7 and Spring 4.0.x recently in a project. I have setup a context hierarchy to inject beans, so far, I have discovered only one limitiation but that does not seem relate to Spring 4 but rather to the module itself or the HK2 Spring Bridge.

To give more insight about my use. I have a XJC/JAXB-backed which is consumed by a common service, repository and exposed through JAX-WS, and now hopefully through JAX-RS.

The multi-context stuff works now with @Autowiredwith 2.8-SNAPSHOT. I have applied my changes and the 2.8-SNAPSHOT to 2.7. Here is the diff.

Edit (Michael-O; 2014-10-17): Here is a modified Spring module based off 2.11 with multi-context support.




回答2:


Not an answer to original question, just related information

This may be a little premature, but the new Major 3.0 version of Jersey will be using Spring 4, in the new jersey-spring4 module. The new Major version will be built with Java 8. Though a new Major version will be released, the 2.x line will still be actively developed to keep support for Java 7

I'll update this post once 3.0 has been release.

For anyone interested, you can see this mailing list to see what the Jersey team has to say about the new 3.x line.




回答3:


Not sure if you came across any issues but I currently face one. It is described in other thread.

Simply, using jersey-spring3 2.12 and spring 4.1.0.RELEASE in one maven project leads to following class incompatibility:

2014-09-14 01:15:44.175:WARN:oejuc.AbstractLifeCycle:main: FAILED org.eclipse.jetty.server.handler.HandlerCollection@696
db620[org.eclipse.jetty.server.handler.ContextHandlerCollection@27abb6ca[o.e.j.m.p.JettyWebAppContext@737d100a{/,file:/C
:/Users/Josef/Workspace/TransitCenter/src/main/webapp/,STARTING}{file:/C:/Users/Josef/Workspace/TransitCenter/src/main/w
ebapp/}], org.eclipse.jetty.server.handler.DefaultHandler@6968c1d6, org.eclipse.jetty.server.handler.RequestLogHandler@7
d986d83]: java.lang.NoSuchMethodError: org.springframework.beans.factory.support.DefaultListableBeanFactory.getDependenc
yComparator()Ljava/util/Comparator;
java.lang.NoSuchMethodError: org.springframework.beans.factory.support.DefaultListableBeanFactory.getDependencyComparato
r()Ljava/util/Comparator;
        at org.springframework.context.annotation.AnnotationConfigUtils.registerAnnotationConfigProcessors(AnnotationCon
figUtils.java:136)


来源:https://stackoverflow.com/questions/21443088/using-jersey-spring-with-spring-4-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!