This is an automated email from the ASF dual-hosted git repository. coheigea pushed a commit to branch coheigea/jaxrs-archetype in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 16af816af8b6977064f0ff191750e63c11c65d96 Author: Colm O hEigeartaigh <[email protected]> AuthorDate: Tue Feb 21 09:51:22 2023 +0000 Removing old Jackson version from CXF JAX-RS archetype --- .../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()); } }
