标签:
1.maven 配置
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.han.mvclient</groupId>
<artifactId>mvclient</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>mvclient Maven Webapp</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>datanucleus</id>
<url>http://www.datanucleus.org/downloads/maven2/</url>
</repository>
<repository>
<id>ibiblio</id>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
</repository>
<repository>
<id>gwt-maven</id>
<url>http://gwt-maven.googlecode.com/svn/trunk/mavenrepo/</url>
</repository>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
</repository>
<repository>
<id>jboss</id>
<url>http://repository.jboss.com/maven2</url>
</repository>
<repository>
<id>gilead-maven-repo</id>
<url>https://gilead.svn.sourceforge.net/svnroot/gilead/gilead/maven-repo</url>
</repository>
<repository>
<id>hibernat4gwt-repo</id>
<url>https://hibernate4gwt.svn.sourceforge.net/svnroot/hibernate4gwt/branches/jens_meiss/maven/</url>
</repository>
<repository>
<id>gilead-repo</id>
<name>Gilead Maven Repository</name>
<url>https://gilead.svn.sourceforge.net/svnroot/gilead/gilead/maven-repo</url>
</repository>
</repositories>
<properties>
<org.springframework-version>3.2.8.RELEASE</org.springframework-version>
<junit-version>4.12</junit-version>
<cxf.version>2.5.2</cxf.version>
<!--<cxf.version>3.0.3</cxf.version>-->
<httpclient.version>3.1</httpclient.version>
</properties>
<dependencies>
<!--spring相关-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<!--cxf框架-->
<!--ws-->
<!--<dependency>-->
<!--<groupId>org.apache.cxf</groupId>-->
<!--<artifactId>cxf-rt-frontend-jaxws</artifactId>-->
<!--<version>${cxf.version}</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.apache.cxf</groupId>-->
<!--<artifactId>cxf-rt-transports-http</artifactId>-->
<!--<version>${cxf.version}</version>-->
<!--</dependency>-->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${cxf.version}</version>
</dependency>
<!--rest-->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0-m10</version>
</dependency>
<!--client-->
<!--<dependency>-->
<!--<groupId>org.apache.cxf</groupId>-->
<!--<artifactId>cxf-rt-rs-client</artifactId>-->
<!--<version>3.0.3</version>-->
<!--</dependency>-->
<!-- http://mvnrepository.com/artifact/javax/javaee-api -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
<!--测试相关-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>mvclient</finalName>
</build>
</project>
2、web.xml配置
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:spring.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!--cxf-->
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
</web-app>
备注:spring版本3.2.8 cxf版本2.5.2
cxf + spring + maven 开发webservice
标签:
原文地址:http://www.cnblogs.com/siashan/p/5581107.html