Spring+springmvc+hibernate Integration Notes (i) Project structure and configuration

Source: Internet
Author: User
Tags one table

(1) Entity package: Place the entities in the Project class (one table one class), Pojo


(2) Util Toolkit: Various tool classes (Stringhelper Class)


----M-----


(3) DAO Interface Pack: Various operation interface classes (ICRM_USERDAO)


(4) Dao.impl Implementation Interface package: Various internship Operation interface implementation Class (CRM_USERDAOIMPL)


(5) Service Interface Package: interface for business implementation (Icrm_userservice)


(6) Service.impl implementation class for implementing the Business Interface (CRM_USERSERVICEIMPL)


(7) Controller Package: Controllers implementation Class (Crm_usercontroller) (C)


(8) Config (not a folder, is a resource bundle) to put SPRINGMVC and hibernate configuration files



Reference relationships between schema project packages:


Request-->controller--> Service Pack---> DAO package---> DB

(1) Download SPRINGMVC and Hibernate framework: Spring Framework and SPRINGMVC framework, they are naturally integrated.

SPRINGMVC Official website: http://projects.spring.io/spring-framework/


: http://repo.spring.io/release/org/springframework/spring/4.2.2.RELEASE/



Download only:


Spring-framework-4.2.2.release-dist.zip


Spring-framework-4.2.2.release-docs.zip


Spring-framework-4.2.2.release-schema.zip


Hibernate official Website: http://hibernate.org/orm/


Install SPRINGMVC plugin online: (STS) http://dist.springsource.com/release/TOOLS/update/e4.4/


Installing Hibernate Tools Plugins Online


Http://tools.jboss.org/downloads/jbosstools/kepler/4.1.2.Final.html



(2) Import the SSH framework integrated JAR package:


2.1 Importing the SPRINGMVC jar package:

2.2 Import the Hibernate jar package;

2.3 Importing a three-party dependent package

2.4 MySQL Driver pack

(3) Configuring Web. Xml

3.1 Configure the Spring IOC container;

3.2 Configuring the SPIRNGMVC Controller (Servlet)

3.3 Configuring Hiddenhttpmethodfilter (to implement rest)

(4) Configuring SPRINGMVC Configuration

4.1 Importing namespaces;

4.2 Configuring the scanned package;

4.3 Configuring the View resolver

4.4 Configuring static Resources

4.5 Notes

4.6 Import the relevant Jackson jar package if you need to return JSON data

4.6.1 Jackson-annotation-2.5.0.jar

4.6.2Jackson-core-2.5.0.jar

4.6.3Jackson-databind-2.5.0.jar


(5) Configure Spring

5.1 Importing namespaces;

5.2 Configure the automatic scanning package;

5.3 Configuring the data source

5.4 Configuring DataSource (with C3P0-related jar packages)

5.4.1C3p0-0.9.2.1.jar

5.4.2Hibernate-c3p0-4.2.21.final.jar

5.4.3Mchange-commons-java-0.2.3.4.jar

5.5 Integration Hibernate

5.5.1 Configuration Sessionfactory

5.5.2 configuring Hibernate for Transaction manager

(6) SSH integration test

6.1 New test package;

6.2 Create a JUnit test class;

6.3 Test Data source

6.4 Test Sessionfactory

6.5 Test Operation database table! (session)

Attached: Jackson related JAR Pack: http://elyar.blog.51cto.com/9864306/1901764


This article from "Sharing is the best memory" blog, declined reprint!

Spring+springmvc+hibernate Integration Notes (i) Project structure and configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.