Spring 6 examples back
Signed-off-by: jansupol <jan.supol@oracle.com>
diff --git a/examples/helloworld-spring-annotations/README.MD b/examples/helloworld-spring-annotations/README.MD
index 63e6780..cec2cf5 100644
--- a/examples/helloworld-spring-annotations/README.MD
+++ b/examples/helloworld-spring-annotations/README.MD
@@ -1,4 +1,4 @@
-[//]: # " Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. "
+[//]: # " Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved. "
[//]: # " "
[//]: # " This program and the accompanying materials are made available under the "
[//]: # " terms of the Eclipse Distribution License v. 1.0, which is available at "
@@ -10,7 +10,7 @@
==========================================================
This example demonstrates how to create simple Jersey application that
-utilises Spring 3 DI features based on Spring annotations, packaged into WAR file.
+utilises Spring 6 DI features based on Spring annotations, packaged into WAR file.
Contents
--------
diff --git a/examples/helloworld-spring-annotations/pom.xml b/examples/helloworld-spring-annotations/pom.xml
index 71a2391..26fe299 100644
--- a/examples/helloworld-spring-annotations/pom.xml
+++ b/examples/helloworld-spring-annotations/pom.xml
@@ -15,11 +15,19 @@
<parent>
<artifactId>project</artifactId>
<groupId>org.glassfish.jersey.examples</groupId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>3.0.99-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>helloworld-spring-annotations</artifactId>
- <description>Spring 4 Integration Jersey Example</description>
+ <description>Spring 6 Integration Jersey Example</description>
+
+ <repositories>
+ <repository>
+ <name>Spring Repository</name>
+ <id>spring-repository</id>
+ <url>https://repo.spring.io/milestone</url>
+ </repository>
+ </repositories>
<dependencies>
<dependency>
@@ -32,16 +40,37 @@
</dependency>
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
- <artifactId>jersey-spring5</artifactId>
+ <artifactId>jersey-spring6</artifactId>
<version>${project.version}</version>
</dependency>
+
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
- <version>${spring5.version}</version>
- <scope>compile</scope>
+ <version>${spring6.version}</version>
</dependency>
<dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>${spring6.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>${spring6.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${spring6.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ <version>${spring6.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
@@ -52,9 +81,9 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <version>3.0.1</version>
+ <groupId>jakarta.servlet</groupId>
+ <artifactId>jakarta.servlet-api</artifactId>
+ <version>${servlet5.version}</version>
</dependency>
</dependencies>
diff --git a/examples/helloworld-spring-annotations/src/main/java/org/glassfish/jersey/examples/hello/spring/annotations/App.java b/examples/helloworld-spring-annotations/src/main/java/org/glassfish/jersey/examples/hello/spring/annotations/App.java
index 3556034..d1451c8 100644
--- a/examples/helloworld-spring-annotations/src/main/java/org/glassfish/jersey/examples/hello/spring/annotations/App.java
+++ b/examples/helloworld-spring-annotations/src/main/java/org/glassfish/jersey/examples/hello/spring/annotations/App.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
@@ -28,7 +28,7 @@
private static final URI BASE_URI = URI.create("http://localhost:8080/base/");
- public static final String ROOT_PATH = "base";
+ public static final String ROOT_PATH = "spring-resource";
public static void main(String[] args) {
try {
diff --git a/examples/helloworld-spring-webapp/pom.xml b/examples/helloworld-spring-webapp/pom.xml
index d4e1eee..7948f93 100644
--- a/examples/helloworld-spring-webapp/pom.xml
+++ b/examples/helloworld-spring-webapp/pom.xml
@@ -25,14 +25,22 @@
<parent>
<groupId>org.glassfish.jersey.examples</groupId>
<artifactId>project</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>3.0.99-SNAPSHOT</version>
</parent>
<artifactId>helloworld-spring-webapp</artifactId>
<packaging>war</packaging>
<name>jersey-examples-helloworld-spring-webapp</name>
- <description>Spring 4 Integration Jersey Example</description>
+ <description>Spring 6 Integration Jersey Example</description>
+
+ <repositories>
+ <repository>
+ <name>Spring Repository</name>
+ <id>spring-repository</id>
+ <url>https://repo.spring.io/milestone</url>
+ </repository>
+ </repositories>
<dependencies>
<dependency>
@@ -43,11 +51,37 @@
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
</dependency>
+
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
- <version>${spring4.version}</version>
- <scope>compile</scope>
+ <version>${spring6.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>${spring6.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>${spring6.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${spring6.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ <version>${spring6.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>jakarta.servlet</groupId>
+ <artifactId>jakarta.servlet-api</artifactId>
+ <version>${servlet5.version}</version>
</dependency>
<dependency>
@@ -64,18 +98,11 @@
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
- <artifactId>jersey-spring4</artifactId>
+ <artifactId>jersey-spring6</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>servlet-api-2.5</artifactId>
- <version>${jetty.servlet.api.25.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
@@ -86,8 +113,13 @@
<plugins>
<!-- Run the application using "mvn jetty:run" to deploy to Jetty-->
<plugin>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>maven-jetty-plugin</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-maven-plugin</artifactId>
+ <configuration>
+ <webApp>
+ <contextPath>/helloworld-spring-webapp</contextPath>
+ </webApp>
+ </configuration>
</plugin>
</plugins>
</build>
diff --git a/examples/helloworld-spring-webapp/src/main/java/org/glassfish/jersey/examples/helloworld/spring/CustomExceptionMapper.java b/examples/helloworld-spring-webapp/src/main/java/org/glassfish/jersey/examples/helloworld/spring/CustomExceptionMapper.java
index 4ca8d6c..a0deb27 100644
--- a/examples/helloworld-spring-webapp/src/main/java/org/glassfish/jersey/examples/helloworld/spring/CustomExceptionMapper.java
+++ b/examples/helloworld-spring-webapp/src/main/java/org/glassfish/jersey/examples/helloworld/spring/CustomExceptionMapper.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
@@ -10,8 +10,6 @@
package org.glassfish.jersey.examples.helloworld.spring;
-import org.springframework.stereotype.Component;
-
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;
diff --git a/examples/helloworld-spring-webapp/src/main/java/org/glassfish/jersey/examples/helloworld/spring/GreetingServiceImpl.java b/examples/helloworld-spring-webapp/src/main/java/org/glassfish/jersey/examples/helloworld/spring/GreetingServiceImpl.java
index 9b94788..652e763 100644
--- a/examples/helloworld-spring-webapp/src/main/java/org/glassfish/jersey/examples/helloworld/spring/GreetingServiceImpl.java
+++ b/examples/helloworld-spring-webapp/src/main/java/org/glassfish/jersey/examples/helloworld/spring/GreetingServiceImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
diff --git a/examples/pom.xml b/examples/pom.xml
index 70cf162..7edd695 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -78,8 +78,6 @@
<module>helloworld-pure-jax-rs</module>
<module>helloworld-webapp</module>
<module>helloworld-weld</module>
-<!-- <module>helloworld-spring-webapp</module>-->
-<!-- <module>helloworld-spring-annotations</module>-->
<module>http-patch</module>
<module>http-trace</module>
<module>https-clientserver-grizzly</module>
@@ -279,4 +277,17 @@
</resources>
</build>
+ <profiles>
+ <profile>
+ <id>jdk17</id>
+ <activation>
+ <jdk>[17,)</jdk>
+ </activation>
+ <modules>
+ <module>helloworld-spring-webapp</module>
+ <module>helloworld-spring-annotations</module>
+ </modules>
+ </profile>
+ </profiles>
+
</project>