jersey 1.17+spring 3.1.0.RELEASE+hibernate 3.3.1.GA maven 配置文
忙了一天,终于把框架搭建起来了,很高兴。公司要求使用 jersey 1.17+spring 3.1.0.RELEASE+hibernate 3.3.1.GA 来完成框架,以前都用springmvc的。今天新东西就当学些了。下面把配置文件及源代码部署出来,供参考。pom.xml内容如下
<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>ysb.unicorm</groupId> <artifactId>jplatform</artifactId> <packaging>war</packaging> <version>0.0.1-SNAPSHOT</version> <name>jplatform Maven Webapp</name> <url>http://maven.apache.org</url> <properties> <org.springframework.version>3.1.0.RELEASE</org.springframework.version> <org.hibernate.version>3.3.1.GA</org.hibernate.version> <org.hibernate.entitymanager.version>3.4.0.GA</org.hibernate.entitymanager.version> <connect.mysql.java.version>5.1.26</connect.mysql.java.version> <com.sun.jersey.version>1.17</com.sun.jersey.version> </properties> <dependencies> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1-b02</version> <type>jar</type> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.6</version> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-servlet</artifactId> <version>${com.sun.jersey.version}</version> <!--<scope>provided</scope>--> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-json</artifactId> <version>${com.sun.jersey.version}</version> <!--<scope>provided</scope>--> </dependency> <dependency> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-multipart</artifactId> <version>${com.sun.jersey.version}</version> <!--<scope>provided</scope>--> </dependency> <dependency> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-spring</artifactId> <version>${com.sun.jersey.version}</version> </dependency> <!-- 添加spring 支持 --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> <version>${org.springframework.version}</version> </dependency> <!-- 添加hhibernate支持 --> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-annotations</artifactId> <version>${org.hibernate.version}</version> <exclusions> <exclusion> <artifactId>asm-attrs</artifactId> <groupId>asm</groupId> </exclusion> <exclusion> <artifactId>asm</artifactId> <groupId>asm</groupId> </exclusion> <exclusion> <artifactId>cglib</artifactId> <groupId>cglib</groupId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>${org.hibernate.entitymanager.version}</version> </dependency> <!-- 添加mysql 支持 --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>${connect.mysql.java.version}</version> </dependency> <!-- 添加dbcp支持 --> <dependency> <groupId>commons-dbcp</groupId> <artifactId>commons-dbcp</artifactId> <version>1.4</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>1.7.2</version> </dependency> <dependency> <groupId>cglib</groupId> <artifactId>cglib-nodep</artifactId> <version>2.1_3</version> </dependency> <!-- log4j --> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.16</version> <scope>runtime</scope> </dependency> </dependencies> <build> <finalName>jplatform</finalName> </build> </project>
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> <!-- 添加spring应用 --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:applicationContext-*.xml</param-value> </context-param> <context-param> <param-name>SystemGlobalsPropertiesn</param-name> <param-value>SystemGlobals.properties</param-value> </context-param> <filter> <filter-name>Spring character encoding filter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>Spring character encoding filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- --> <listener> <listener-class>com.ysb.unicorm.listeners.ConfigInitializer</listener-class> </listener> <servlet> <servlet-name>com.sun.jersey.samples.helloworld.resources.MyApplication</servlet-name> <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class> <init-param> <param-name>com.sun.jersey.config.property.packages</param-name> <param-value>com.ysb.unicorm.controllers</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>com.sun.jersey.samples.helloworld.resources.MyApplication</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> </web-app>
相关推荐
Kafka 2020-09-18
Wepe0 2020-10-30
杜倩 2020-10-29
windle 2020-10-29
minerd 2020-10-28
mengzuchao 2020-10-22
Junzizhiai 2020-10-10
bxqybxqy 2020-09-30
风之沙城 2020-09-24
kingszelda 2020-09-22
大唐帝国前营 2020-08-18
yixu0 2020-08-17
TangCuYu 2020-08-15
xiaoboliu00 2020-08-15
songshijiazuaa 2020-08-15
xclxcl 2020-08-03
zmzmmf 2020-08-03
newfarhui 2020-08-03
likesyour 2020-08-01