我想知道我需要什么样的罐子才能让Spring + Jersey发挥作用。
现在我把以下的罐装在我的buldpath中。
Jersey-server-1.18
Spring 4.0.6
但我的申请似乎没有奏效。我应该用什么来使它发挥作用。
答案 0 :(得分:0)
如果您想使用Jersey Spring DI支持,您需要添加jersey-spring3模块。这是我的测试项目中的配置和相应的jar。其中很少可能是可选的。
的Maven:
<dependencies>
<!-- Jersey -->
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring3</artifactId>
<version>2.11</version>
<exclusions>
<exclusion>
<artifactId>spring-context</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>spring-beans</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>spring-core</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>spring-web</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>jersey-server</artifactId>
<groupId>org.glassfish.jersey.core</groupId>
</exclusion>
<exclusion>
<artifactId>
jersey-container-servlet-core
</artifactId>
<groupId>org.glassfish.jersey.containers</groupId>
</exclusion>
<exclusion>
<artifactId>hk2</artifactId>
<groupId>org.glassfish.hk2</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.2</version>
</dependency>
<!-- Spring 4 dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>4.0.6.RELEASE</version>
</dependency>
</dependencies>
罐:
jersey-spring3-2.11.jar
spring-bridge-2.3.0-b05.jar
javax.ws.rs-api-2.0.jar
jsr250-api-1.0.jar
javax.annotation-api-1.2.jar
spring-core-4.0.6.RELEASE.jar
commons-logging-1.1.3.jar
spring-context-4.0.6.RELEASE.jar
spring-aop-4.0.6.RELEASE.jar
aopalliance-1.0.jar
spring-expression-4.0.6.RELEASE.jar
spring-beans-4.0.6.RELEASE.jar
spring-web-4.0.6.RELEASE.jar
spring-aspects-4.0.6.RELEASE.jar
aspectjweaver-1.8.1.jar