You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2023/02/21 11:06:18 UTC

[cxf] branch main updated: Removing old Jackson version from CXF JAX-RS archetype (#1149)

This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/main by this push:
     new 96bf7ded9f Removing old Jackson version from CXF JAX-RS archetype (#1149)
96bf7ded9f is described below

commit 96bf7ded9f4c74a8eaa2f30287e9f296260510ec
Author: Colm O hEigeartaigh <co...@users.noreply.github.com>
AuthorDate: Tue Feb 21 11:06:11 2023 +0000

    Removing old Jackson version from CXF JAX-RS archetype (#1149)
---
 .../src/main/resources/archetype-resources/pom.xml   | 20 ++++++--------------
 .../src/main/webapp/WEB-INF/beans.xml                |  5 ++---
 .../src/test/java/HelloWorldIT.java                  |  8 ++------
 3 files changed, 10 insertions(+), 23 deletions(-)

diff --git a/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/pom.xml b/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/pom.xml
index d2dbd526ee..adde535fe1 100644
--- a/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/pom.xml
+++ b/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/pom.xml
@@ -7,9 +7,6 @@
     <packaging>war</packaging>
     <name>Simple CXF JAX-RS webapp service using spring configuration</name>
     <description>Simple CXF JAX-RS webapp service using spring configuration</description>
-    <properties>
-        <jackson.version>1.8.6</jackson.version>
-    </properties>
     <dependencies>
         <dependency>
             <groupId>org.apache.cxf</groupId>
@@ -22,19 +19,14 @@
             <version>${project.version}</version>
         </dependency>
         <dependency>
-            <groupId>org.codehaus.jackson</groupId>
-            <artifactId>jackson-core-asl</artifactId>
-            <version>${jackson.version}</version>
+            <groupId>com.fasterxml.jackson.jaxrs</groupId>
+            <artifactId>jackson-jaxrs-json-provider</artifactId>
+            <version>${cxf.jackson.version}</version>
         </dependency>
         <dependency>
-            <groupId>org.codehaus.jackson</groupId>
-            <artifactId>jackson-mapper-asl</artifactId>
-            <version>${jackson.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.codehaus.jackson</groupId>
-            <artifactId>jackson-jaxrs</artifactId>
-            <version>${jackson.version}</version>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>${cxf.spring.version}</version>
         </dependency>
         <dependency>
             <groupId>org.springframework</groupId>
diff --git a/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/beans.xml b/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/beans.xml
index f7eff67794..cfa32e504a 100644
--- a/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/beans.xml
+++ b/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/beans.xml
@@ -7,14 +7,13 @@
     <import resource="classpath:META-INF/cxf/cxf.xml"/>
     <context:property-placeholder/>
     <context:annotation-config/>
-    <bean class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer"/>
     <bean class="org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer"/>
     <jaxrs:server id="services" address="/">
         <jaxrs:serviceBeans>
             <bean class="${package}.HelloWorld"/>
         </jaxrs:serviceBeans>
         <jaxrs:providers>
-            <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/>
+            <bean class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider"/>
         </jaxrs:providers>
     </jaxrs:server>
-</beans>
\ No newline at end of file
+</beans>
diff --git a/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/test/java/HelloWorldIT.java b/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/test/java/HelloWorldIT.java
index eaf7d11e03..3aae5f9008 100644
--- a/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/test/java/HelloWorldIT.java
+++ b/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/test/java/HelloWorldIT.java
@@ -10,8 +10,6 @@ import jakarta.ws.rs.core.Response;
 
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.jaxrs.client.WebClient;
-import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.map.MappingJsonFactory;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -35,7 +33,7 @@ public class HelloWorldIT {
     @Test
     public void testJsonRoundtrip() throws Exception {
         List<Object> providers = new ArrayList<>();
-        providers.add(new org.codehaus.jackson.jaxrs.JacksonJsonProvider());
+        providers.add(new com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider());
         JsonBean inputBean = new JsonBean();
         inputBean.setVal1("Maple");
         WebClient client = WebClient.create(endpointUrl + "/hello/jsonBean", providers);
@@ -43,9 +41,7 @@ public class HelloWorldIT {
             .type("application/json")
             .post(inputBean);
         assertEquals(Response.Status.OK.getStatusCode(), r.getStatus());
-        MappingJsonFactory factory = new MappingJsonFactory();
-        JsonParser parser = factory.createJsonParser((InputStream)r.getEntity());
-        JsonBean output = parser.readValueAs(JsonBean.class);
+        JsonBean output = r.readEntity(JsonBean.class);
         assertEquals("Maple", output.getVal2());
     }
 }