Using SSM (Spring, for SpringMVC and Mybatis) already has more than three months, the project has no difficulty in technology, based on the existing technology can realize the function you want to, sure, of course, there are many places can be improved, before there is no record of SSM integration process, this time just right based on their own a small project to set up again, and is better than project set up, the process and methods to solve the problem before was not record in time, in their own small project I encounter I arrange to share again, this time, say first three framework integration process, personally think that using a framework is not very difficult, the key to understand his thoughts, this is very helpful for us to improve the level of programming, however, if can't use, talking about ideas become a theory!!!!!! Technology, and then thought, knowledge comes from practice, watermark view blog address (by picture)
1, the basic concept of
1.1, Spring
Spring is an open source framework, Spring is in 2003 the rise of a lightweight Java Development framework, in the works by Rod Johnson Expert One - On - One, this part of the J2EE Development and Design concept and prototypes derived, it is to solve the complexity of enterprise application Development, and create the Spring using the basic JavaBean to complete before things can only be performed by the EJB, however, the purpose of the Spring is not limited to server-side Development, from the simple, testability, and loose coupling point of view, any Java application can benefit from the Spring, in simple terms, the Spring is a lightweight inversion of control (IoC) and the aspect oriented (AOP) container framework,
1.2, for SpringMVC
, Spring MVC belong to SpringFrameWork subsequent products have fusion in Spring Web Flow, Spring MVC separates the controller, model objects, dispatcher and the role of handler object, this separation makes them easier to customize,
1.3, MyBatis
MyBatis the iBatis is an apache open source project, the project by the apache software foundation in 2010 moved to the Google code, and changed its name to MyBatis, MyBatis is a java-based persistence layer framework, iBatis persistence layer framework including SQL Maps and Data Access Objects (DAO) MyBatis eliminates almost all JDBC code and parameters manually set and retrieve the result set, MyBatis using simple XML or annotations for configuration and the original mapping, the interface and Java POJOs (Plain Old Java Objects, ordinary Java Objects) mapping database records,
2, the development environment to build
If you need, see previous post: http://blog.csdn.net/zhshulin/article/details/30779873
3, the Maven Web project to create
If you need, see previous post: http://blog.csdn.net/zhshulin/article/details/37921705
4, integrate SSM
Mainly introduces the three frameworks under integration, as for the environmental construction and project to create, see the above post, I got the two configuration files, the integration, respectively is spring - mybatis. XML, contains the spring and mybatis configuration file, one is spring MVC - the configuration file, in addition has two resource files: JDBC. Propertis and log4j properties, the complete directory structure is as follows:
Using a framework is the newer version:
Spring 4.0.2 RELEASE
Spring MVC 4.0.2 RELEASE
MyBatis 3.2.6
4.1, Maven introduced need JAR package
For the convenience of the time don't need to introduce later said the JAR package, I here directly given all the required jars, which are basic JAR package, every package is stem what of, is no longer say more,
Pom. XML