From f6f3d6069f3b8feb4a6cba22d57cfe2ea8b91795 Mon Sep 17 00:00:00 2001 From: Imran M Yousuf Date: Sat, 13 Dec 2008 19:58:59 +0600 Subject: [PATCH] Add spring framework integration Signed-off-by: Imran M Yousuf --- WebServiceServer/pom.xml | 22 +++++++++++++----- .../ws/server/PublicationHouseResource.java | 6 +++++ .../src/main/webapp/WEB-INF/unitTestWeb.xml | 27 ++++++++++++++++++++++ .../src/resources/unitTestApplicationContext.xml | 22 ++++++++++++++++++ 4 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 WebServiceServer/src/main/webapp/WEB-INF/unitTestWeb.xml create mode 100644 WebServiceServer/src/resources/unitTestApplicationContext.xml diff --git a/WebServiceServer/pom.xml b/WebServiceServer/pom.xml index 1d0562c..ea86207 100644 --- a/WebServiceServer/pom.xml +++ b/WebServiceServer/pom.xml @@ -32,6 +32,22 @@ ${jersey.version} + com.sun.jersey.contribs + jersey-spring + ${jersey.version} + + + com.sun.jersey + jersey-client + ${jersey.version} + test + + + org.springframework + spring + 2.5.4 + + junit junit 3.8.2 @@ -50,12 +66,6 @@ test - com.sun.jersey - jersey-client - ${jersey.version} - test - - com.smartitengineering.bookstore ServiceAPI ${project.version} diff --git a/WebServiceServer/src/main/java/com/smartitengineering/bookstore/ws/server/PublicationHouseResource.java b/WebServiceServer/src/main/java/com/smartitengineering/bookstore/ws/server/PublicationHouseResource.java index ecf0a2a..341b7af 100644 --- a/WebServiceServer/src/main/java/com/smartitengineering/bookstore/ws/server/PublicationHouseResource.java +++ b/WebServiceServer/src/main/java/com/smartitengineering/bookstore/ws/server/PublicationHouseResource.java @@ -8,19 +8,25 @@ import com.smartitengineering.bookstore.service.api.PublicationHouseService; import com.smartitengineering.bookstore.ws.server.element.PublicationHouseElement; import com.smartitengineering.bookstore.ws.server.element.PublicationHouseElements; import com.smartitengineering.bookstore.ws.server.element.PublicationHouseFilterElement; +import javax.annotation.Resource; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; /** * * @author imyousuf */ @Path("/pub-house") +@Component +@Scope(value="singleton") @Produces("application/xml") public class PublicationHouseResource { + @Resource(name="publicationHouseService") private PublicationHouseService publicationHouseService; public void create(PublicationHouseElement publicationHouseElement) { diff --git a/WebServiceServer/src/main/webapp/WEB-INF/unitTestWeb.xml b/WebServiceServer/src/main/webapp/WEB-INF/unitTestWeb.xml new file mode 100644 index 0000000..2c388aa --- /dev/null +++ b/WebServiceServer/src/main/webapp/WEB-INF/unitTestWeb.xml @@ -0,0 +1,27 @@ + + + + contextConfigLocation + classpath:unitTestApplicationContext.xml + + + org.springframework.web.context.ContextLoaderListener + + + Jersey Spring Web Application + com.sun.jersey.spi.spring.container.servlet.SpringServlet + + + com.sun.jersey.config.property.packages + com.smartitengineering.bookstore.ws.server + + 1 + + + Jersey Spring Web Application + /* + + diff --git a/WebServiceServer/src/resources/unitTestApplicationContext.xml b/WebServiceServer/src/resources/unitTestApplicationContext.xml new file mode 100644 index 0000000..4f6f642 --- /dev/null +++ b/WebServiceServer/src/resources/unitTestApplicationContext.xml @@ -0,0 +1,22 @@ + + + + + + + + + \ No newline at end of file -- 2.11.4.GIT