In order to comb the contents of Spring Integration MyBatis (MAVEN+MYSQL) and spring Integration MyBatis (MAVEN+MYSQL) in the previous study , Prepare a complete example to complete a simple book management function, the main use of the technology include spring, MyBatis, maven and MySQL and so on. The final operating effect is as follows:
The project structure is as follows:
One, create a new MAVEN based Web project
1.1. Create a simple MAVEN project with the following project information:
1.2, modify the level of information, in the project right key to select Properties, and then select "Project Facets", first set the Java operating environment to 1.7, first remove the "Dynamic Web Module" before the tick, and then save the check, and then turn on the "Dynamic web Module ", the version Select" 3.0 "; here in the lower left solution a hyperlink appears, creating" Web Content "to complete the shutdown.
1.3, modify the project deployment content. Right-click Properties on the Item, select "Deplyment Assembly", delete the content that does not need to be published, such as: two directories with "test", WebContent directory, and add a WebApp directory under Main.
The modified results are as follows:
1.4, modify the content of the project. Copy the contents under WebContent to/src/main/webapp, and then delete the WebContent directory, and the resulting results are as follows:
1.5, add "Server Runtime", add the following results:
ii. creating databases and Tables
Third, add dependencies
Iv. New Pojo entity layer
V. New MyBatis SQL Map layer
Vi. Creating a service layer
Vii. completing the Spring consolidation MyBatis configuration
Viii. creating a servlet and implementing functionality
Ix. Test Run
The above spring integration MyBatis complete example (sharing) is a small series to share all the content, hope to give you a reference, but also hope that we support the cloud habitat community.