Jersey 2.x Glassfish 中基于 Servlet 的应用

若是你使用的是 Glassfish 做为你应用服务器,你不须要在你的引用中包含引用任何东西,全部你须要的都已经包含进去了。java

你只须要定义 JAX-RS API 以便于你可以对你的应用进行编辑,使用 (provided)依赖。api

1服务器

2ide

3spa

4code

5server

6ci

<dependency>get

    <groupId>javax.ws.rs</groupId>servlet

    <artifactId>javax.ws.rs-api</artifactId>

    <version>2.1</version>

    <scope>provided</scope>

</dependency>

若是你须要使用 Jersey 的一些特定特性,你须要基于你的 Jersey 目录进行添加。

1

2

3

4

5

6

7

8

9

10

11

12

13

<dependency>

<groupId>org.glassfish.jersey.containers</groupId>

<artifactId>jersey-container-servlet</artifactId>

<version>2.27</version>

<scope>provided</scope>

</dependency>

<!-- if you are using Jersey client specific features without the server side -->

<dependency>

<groupId>org.glassfish.jersey.core</groupId>

<artifactId>jersey-client</artifactId>

<version>2.27</version>

<scope>provided</scope>

</dependency>

https://www.cwiki.us/display/JERSEYZH/Common+Jersey+Use+Cases

相关文章
相关标签/搜索