Primary configuration Files
Pom.xml Project MAVEN configuration file management project required jar dependency support
Total configuration file for Web. XML project: Add Spring and hibernate support
Applicationcontext.xml Hibernate configuration file
Sping-servlet.xml Spring's configuration file
Jdbc-properties Database Connection Properties File
------------------------------Pom.xml started----------------------------------------------
<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.o2ole</groupId> <artifactId>CheLL</artifactId> <packagin g>war</packaging> <version>0.0.1-SNAPSHOT</version> <name>CheLL</name> <URL&G T;http://www.o2ole.com</url><properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </propertie s> <build> <finalName>CheLL</finalName> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.7</source> <target> 1.7</target> <encoding>UTF8</encoding> </configuration> </plugin> </plugins> </build> <organization> <name> Beijing Europe Music Interactive Network Technology Co., Ltd. < /name> <url>http://www.o2ole.com</url></organization> <!--release Support--<distributionManagement> <repository> <id >releases</id> <name>internal releases</name> <url>http://192.168.0.254:8080/nexus/content/repositories/releases</url></repository> <snapshotRepository> <id>snapshots</id> <name>int Ernal snapshots</name> <url>http://192.168.0.254:8080/nexus/content/repositories/snapshots</url> </snapshotRepository> </distributionManagement> <dependencies> <!--junit dependency--& Gt <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> <!--log dependency-<dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> <version>2.0.2</version> </dependency > <dependency> <groupId>org.slf4j</groupId> <artifactid>slf4j-api& Lt;/artifactid> <version>1.7.7</version> </dependency> <!--dependency of the Web module class Library-- > <dependency> <groupId>javax.servlet.jsp</groupId> <artifactid>js P-api</artifactid> <version>2.2</version> <scope>provided</scope> </depen dency> <dependency> <groupId>taglibs</groupId> <artifactid>standar D</artifactid> <version>1.1.2</version> <scope>runtime</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artif Actid>jstl</artifactid> <version>1.2</version> <SCOPE>RUNTIME</SCOPE&G T </dependency> <dependency> <groupId>javax.inject</groupId> <artifa Ctid>javax.inject</artifactid> <version>1</version> </dependency> < !--Persistence class Library dependencies-<dependency> <groupId>mysql</groupId> <artifactid> ; mysql-connectOr-java</artifactid> <version>5.1.25</version> </dependency> <!--spri NG Module Class Library dependencies-<dependency> <groupId>org.springframework</groupId> <ar Tifactid>spring-beans</artifactid> <version>4.1.1.RELEASE</version> </dependency > <dependency> <groupId>org.springframework</groupId> <artifactId> spring-web</artifactid> <version>4.1.1.RELEASE</version> </dependency> &L T;dependency> <groupId>org.springframework</groupId> <artifactid>spring-webmvc& lt;/artifactid> <version>4.1.1.RELEASE</version> </dependency> <dependenc Y> <groupId>org.springframework</groupId> <artifactid>spring-tx</artifactid& Gt <version>4.1.1.release</version> </dependency> <dependency> <GROUPID>ORG.SPR Ingframework</groupid> <artifactId>spring-orm</artifactId> <version>4.1.1.re lease</version> </dependency> <dependency> <GROUPID>ORG.SPRINGFRAMEWORK&L T;/groupid> <artifactId>spring-context</artifactId> <version>4.1.1.release</ Version> </dependency> <!--hibernate dependency--<dependency> <groupid >org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version> ;4.3.6.final</version> </dependency> <dependency> <GROUPID>COMMONS-DBCP&L T;/groupid> <artifactId>commons-dbcp</artifactId> <version>1.4</version> </dependency&gT <!--Jackson's dependency--<dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>2.4.3</version> </de pendency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> < ;artifactid>jackson-databind</artifactid> <version>2.4.3</version> </dependency& Gt <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactid>jacks on-annotations</artifactid> <version>2.4.3</version> </dependency> <!- -Sybot's dependence-<dependency> <groupId>org.sybot</groupId> <artifactid& gt;webbase</artifactid> <version>0.0.1-SNAPSHOT</version> </dependency> </ DepEndencies></project>
------------------------------Pom.xml ended----------------------------------------------
------------------------------Web. XML starts----------------------------------------------
<?xml version= "1.0" encoding= "UTF-8"? ><web-app xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xmlns= "Http://xmlns.jcp.org/xml/ns/javaee" xsi:schemalocation= "Http://xmlns.jcp.org/xml/ns/javaee/http Xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd "version=" 3.1 "><display-name>CheLL</display-name> <context-param><param-name>contextconfiglocation</param-name><param-value>classpath: applicationcontext.xml</param-value></context-param><!--Add character set filter to solve Chinese garbled problem--><filter> <filter-name>CharacterFilter</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><init-param ><param-name>forceencoding</param-name><param-value>true</param-value></ init-param></filter><!--start the Spring window listener--><listener><listener-class>org.springframework.web.context.contextloaderlistener</listener-class></ listener><!--Spring MVC configuration--><servlet><servlet-name>spring</servlet-name>< servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class><init-param>< param-name>contextconfiglocation</param-name><param-value>classpath:spring-servlet.xml</ param-value></init-param><load-on-startup>1</load-on-startup></servlet>< servlet-mapping><servlet-name>spring</servlet-name><url-pattern>/</url-pattern>< /servlet-mapping><!--page Filter--><filter><filter-name>paginationfilter</filter-name> <filter-class>org.sybot.web.easyui.PaginationFilter</filter-class></filter>< Filter-mapping><filter-name>paginationfilter</filter-name><url-pattern>/*</url-pattern ></filter-mapping><!--Application Filter--><filter><filter-name>applicationcontextfilter</filter-name><filter-class> org.sybot.web.filter.applicationcontextfilter</filter-class></filter><filter-mapping>< filter-name>applicationcontextfilter</filter-name><url-pattern>/*</url-pattern></ filter-mapping><filter><filter-name>opensessioninviewerfilter</filter-name>< filter-class>org.springframework.orm.hibernate4.support.opensessioninviewfilter</filter-class></ filter><filter-mapping><filter-name>opensessioninviewerfilter</filter-name>< Url-pattern>/*</url-pattern></filter-mapping></web-app>
------------------------------Web. Xml Ends----------------------------------------------
------------------------------Applicationcontext.xml started----------------------------------------------
<?xml version= "1.0" encoding= "UTF-8"?><!--references Spring's multiple schema format definition files--><beans xmlns= "/http/ Www.springframework.org/schema/beans "xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance "xmlns:p="/HTTP/ www.springframework.org/schema/p "xmlns:context=" Http://www.springframework.org/schema/context "xmlns:aop=" http ://www.springframework.org/schema/aop "xmlns:tx=" Http://www.springframework.org/schema/tx "xsi:schemalocation=" Http://www.springframework.org/schema/beans Http://www.springframework.org/schema/beans/spring-bea Ns-3.1.xsd Http://www.springframework.org/schema/context HTTP://WWW.SPRINGF Ramework.org/schema/context/spring-context-3.1.xsd HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/TX Http://www.springframework.org/schema/tx/spring-tx-3.1.xsd Http://www.springframew ORK.ORG/SCHEMA/AOP http://www.springframework.org/schema/Aop/spring-aop-3.1.xsd "><!--open Spring Annotation support--><context:annotation-config/><!--setting Spring Which package to go to find annotation--><context:component-scan base-package= "Com.o2ole.chell"/><!-- Import the Jdbc.properties file under the src directory--><context:property-placeholder location= "Classpath:jdbc.properties"/><! ---<context:property-placeholder location= "/web-inf/application.properties"/--><!--defining the data source-- ><bean id= "DataSource" class= "Org.apache.commons.dbcp.BasicDataSource" destroy-method= "Close" >< Property Name= "Driverclassname" value= "${jdbc.driverclassname}"/><property name= "url" value= "${jdbc.url}"/ ><property name= "username" value= "${jdbc.username}"/><property name= "password" value= "${jdbc.password} "/><!--Configure the initial value of the connection pool--><property name=" InitialSize "value=" 5 "/><!--when the minimum idle, when the connection is less than Minidle will automatically go to apply for some connections- -><property name= "Minidle" value= "2"/><property name= "maxactive" value= "[/><property]"Name= "Maxidle" value= "/><property name=" maxwait "value=" $ "/></bean><!--define Hibernate-related configuration-- ><bean id= "Sessionfactory" class= "Org.springframework.orm.hibernate4.LocalSessionFactoryBean" ><!-- Injection data source--><property name= "DataSource" ref= "DataSource"/><!--set spring fetch that package to find the corresponding entity class--><property Name= "Packagestoscan" ><list><value>org.sybot.vm.domain</value></list></property ><property name= "hibernateproperties" ><props><prop key= "Hibernate.dialect" > Org.hibernate.dialect.mysqldialect</prop><prop key= "Hibernate.show_sql" >true</prop><prop key= "Hibernate.hbm2ddl.auto" >update</prop><prop key= "Hibernate.format_sql" >true</prop>< /props></property></bean><!--Configuring Spring transaction--><!--Creating a transaction manager--><bean id= "Txmanager" class= "Org.springframework.orm.hibernate4.HibernateTransactionManager" ><property name= "sessionfactory" ref = "SessionFactory "/></bean><tx:annotation-driven transaction-manager=" Txmanager "/></beans>
------------------------------Applicationcontext.xml ended----------------------------------------------
------------------------------Sping-servlet.xml started----------------------------------------------
<?xml version= "1.0" encoding= "UTF-8"? ><beans xmlns= "Http://www.springframework.org/schema/beans"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xmlns:p= "http://www.springframework.org/schema/p"Xmlns:context= "Http://www.springframework.org/schema/context"Xmlns:mvc= "Http://www.springframework.org/schema/mvc"xsi:schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsdhttp//Www.springframework.org/schema/contexthttp//www.springframework.org/schema/context/spring-context-3.1.xsdhttp//Www.springframework.org/schema/mvchttp//www.springframework.org/schema/mvc/spring-mvc-3.1.xsd "><!--Configure static resources to map directly to the corresponding folder--<mvc:resources mapping= "/res/**" location= "/web-inf/resources/"/> <!--sweep Package, automatically converts the class that labels the spring annotation to the bean, and completes the bean injection--<mvc:annotation-driven/> <context:component-scan base- Package= "Com.o2ole.chell"/> <!--Configure the view resolver to parse Modelandview and guest appearances into specific pages--<Beanclass= "Org.springframework.web.servlet.view.InternalResourceViewResolver" > <property name= "Viewclass"value= "Org.springframework.web.servlet.view.JstlView"/> <property name= "prefix" value= "/web-inf/page/"/> <property name= "suffix" value= ". jsp"/> </bean> <Beanclass= "Org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" > <property name= " Messageconverters "> <list> <ref bean=" Mappingjacksonhttpmessageconverter "/> </list> </property> </bean> <bean id= "Mappingjacksonhttpmessageconverter"class= "Org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" > <property name= " Supportedmediatypes "> <list> <value>text/html;charset=UTF-8</value> </list> </property> </bean></beans>
------------------------------Sping-servlet.xml ended----------------------------------------------
------------------------------Jdbc-properties started----------------------------------------------
Jdbc.driverclassname=com.mysql.jdbc.driver
Jdbc.url = Jdbc\:mysql\://192.168.0.200\:3308/chell_center
Jdbc.username = yd
Jdbc.password = 123456
------------------------------Jdbc-properties ended----------------------------------------------
Eclipse new Maven Project Add spring Hibernate configuration file details