Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
699b6ce6
Commit
699b6ce6
authored
May 22, 2018
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove reference to Jersey 1
Closes gh-12582
parent
65738e63
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
7 additions
and
202 deletions
+7
-202
spring-boot-features.adoc
...ing-boot-docs/src/main/asciidoc/spring-boot-features.adoc
+7
-12
README.adoc
spring-boot-samples/README.adoc
+0
-3
pom.xml
spring-boot-samples/pom.xml
+0
-1
pom.xml
spring-boot-samples/spring-boot-sample-jersey1/pom.xml
+0
-81
SampleJersey1Application.java
...rc/main/java/sample/jersey1/SampleJersey1Application.java
+0
-62
application.properties
...-sample-jersey1/src/main/resources/application.properties
+0
-0
SampleJersey1ApplicationTests.java
...st/java/sample/jersey1/SampleJersey1ApplicationTests.java
+0
-43
No files found.
spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
View file @
699b6ce6
...
...
@@ -2763,13 +2763,13 @@ does so, the orders shown in the following table will be used:
[[boot-features-jersey]]
=== JAX-RS and Jersey
If you prefer the JAX-RS programming model for REST endpoints, you can use one of the
available implementations instead of Spring MVC. https://jersey.github.io/[Jersey]
1.x
and
http://cxf.apache.org/[Apache CXF] work quite well out of the box
if you register their
`Servlet` or `Filter` as a `@Bean` in your application context. Jersey 2.x has some native
Spring support, so we also provide auto-configuration support for it in Spring Boot,
together with a starter.
available implementations instead of Spring MVC. https://jersey.github.io/[Jersey] and
http://cxf.apache.org/[Apache CXF] work quite well out of the box
. CXF requires you to
register its `Servlet` or `Filter` as a `@Bean` in your application context. Jersey has
some native Spring support, so we also provide auto-configuration support for it in
Spring Boot,
together with a starter.
To get started with Jersey
2.x
, include the `spring-boot-starter-jersey` as a dependency
To get started with Jersey, include the `spring-boot-starter-jersey` as a dependency
and then you need one `@Bean` of type `ResourceConfig` in which you register all the
endpoints, as shown in the following example:
...
...
@@ -2828,12 +2828,7 @@ the filter registrations can be given init parameters by using `spring.jersey.in
specify a map of properties.
There is a {github-code}/spring-boot-samples/spring-boot-sample-jersey[Jersey sample] so
that you can see how to set things up. There is also a
{github-code}/spring-boot-samples/spring-boot-sample-jersey1[Jersey 1.x sample]. Note
that, in the Jersey 1.x sample, the spring-boot maven plugin has been configured to
unpack some Jersey jars so that they can be scanned by the JAX-RS implementation (because
the sample asks for them to be scanned in its `Filter` registration). If any of your
JAX-RS resources are packaged as nested jars, you may need to do the same.
that you can see how to set things up.
...
...
spring-boot-samples/README.adoc
View file @
699b6ce6
...
...
@@ -84,9 +84,6 @@ The following sample applications are provided:
| Integration application built using Spring Integration and its Java DSL
| link:spring-boot-sample-jersey[spring-boot-sample-jersey]
| RESTful service built using Jersey 2
| link:spring-boot-sample-jersey1[spring-boot-sample-jersey1]
| RESTful service built using Jersey
| link:spring-boot-sample-jetty[spring-boot-sample-jetty]
...
...
spring-boot-samples/pom.xml
View file @
699b6ce6
...
...
@@ -46,7 +46,6 @@
<module>
spring-boot-sample-hateoas
</module>
<module>
spring-boot-sample-integration
</module>
<module>
spring-boot-sample-jersey
</module>
<module>
spring-boot-sample-jersey1
</module>
<module>
spring-boot-sample-jetty
</module>
<module>
spring-boot-sample-jetty-jsp
</module>
<module>
spring-boot-sample-jetty-ssl
</module>
...
...
spring-boot-samples/spring-boot-sample-jersey1/pom.xml
deleted
100644 → 0
View file @
65738e63
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<!-- Your own application should inherit from spring-boot-starter-parent -->
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-samples
</artifactId>
<version>
${revision}
</version>
</parent>
<artifactId>
spring-boot-sample-jersey1
</artifactId>
<name>
Spring Boot Jersey 1 Sample
</name>
<description>
Spring Boot Jersey 1 Sample
</description>
<properties>
<main.basedir>
${basedir}/../..
</main.basedir>
</properties>
<dependencies>
<!-- Compile -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-tomcat
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-web
</artifactId>
</dependency>
<dependency>
<groupId>
com.sun.jersey
</groupId>
<artifactId>
jersey-servlet
</artifactId>
<version>
1.13
</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<configuration>
<requiresUnpack>
<dependency>
<groupId>
com.sun.jersey
</groupId>
<artifactId>
jersey-servlet
</artifactId>
</dependency>
<dependency>
<groupId>
com.sun.jersey
</groupId>
<artifactId>
jersey-server
</artifactId>
</dependency>
<dependency>
<groupId>
com.sun.jersey
</groupId>
<artifactId>
jersey-core
</artifactId>
</dependency>
</requiresUnpack>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>
java9
</id>
<activation>
<jdk>
[9,)
</jdk>
</activation>
<dependencies>
<dependency>
<groupId>
javax.xml.bind
</groupId>
<artifactId>
jaxb-api
</artifactId>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
spring-boot-samples/spring-boot-sample-jersey1/src/main/java/sample/jersey1/SampleJersey1Application.java
deleted
100644 → 0
View file @
65738e63
/*
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
sample
.
jersey1
;
import
javax.ws.rs.GET
;
import
javax.ws.rs.Path
;
import
javax.ws.rs.Produces
;
import
com.sun.jersey.spi.container.servlet.ServletContainer
;
import
org.springframework.boot.WebApplicationType
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory
;
import
org.springframework.boot.web.servlet.FilterRegistrationBean
;
import
org.springframework.context.annotation.Bean
;
@SpringBootApplication
@Path
(
"/"
)
public
class
SampleJersey1Application
{
@GET
@Produces
(
"text/plain"
)
public
String
hello
()
{
return
"Hello World"
;
}
@Bean
// Not needed if Spring Web MVC is also present on classpath
public
TomcatServletWebServerFactory
webServerFactory
()
{
return
new
TomcatServletWebServerFactory
();
}
@Bean
public
FilterRegistrationBean
<
ServletContainer
>
jersey
()
{
FilterRegistrationBean
<
ServletContainer
>
bean
=
new
FilterRegistrationBean
<>();
bean
.
setFilter
(
new
ServletContainer
());
bean
.
addInitParameter
(
"com.sun.jersey.config.property.packages"
,
"com.sun.jersey;sample.jersey1"
);
return
bean
;
}
public
static
void
main
(
String
[]
args
)
{
new
SpringApplicationBuilder
(
SampleJersey1Application
.
class
)
.
web
(
WebApplicationType
.
SERVLET
).
run
(
args
);
}
}
spring-boot-samples/spring-boot-sample-jersey1/src/main/resources/application.properties
deleted
100644 → 0
View file @
65738e63
spring-boot-samples/spring-boot-sample-jersey1/src/test/java/sample/jersey1/SampleJersey1ApplicationTests.java
deleted
100644 → 0
View file @
65738e63
/*
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
sample
.
jersey1
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest.WebEnvironment
;
import
org.springframework.boot.test.web.client.TestRestTemplate
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
webEnvironment
=
WebEnvironment
.
RANDOM_PORT
)
public
class
SampleJersey1ApplicationTests
{
@Autowired
private
TestRestTemplate
restTemplate
;
@Test
public
void
rootReturnsHelloWorld
()
{
assertThat
(
this
.
restTemplate
.
getForObject
(
"/"
,
String
.
class
))
.
isEqualTo
(
"Hello World"
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment