Spring Integrated MyBatis Complete Example

Source: Internet
Author: User

In order to comb the previous study of "Spring integration MyBatis (maven+mysql) One" and "Spring Integration MyBatis (maven+mysql) II" in the content, Get ready to do a complete example of a simple book management function, with the main technologies used include spring, MyBatis, maven, and MySQL. The final performance is as follows:

The project structure is as follows:

I. 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, on the project right-click on the property, and then select "Project Facets", first set the Java Runtime Environment is 1.7, first remove the "Dynamic Web Module" before the tick, and then save the close, and then open the tick "dynamic web Module ", version select" 3.0 "; Here a hyperlink appears in the left-hand solution, creating" Web Content "to complete the shutdown.

1.3. Modify the deployment content of the project. On the project right-click Properties, 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 result of the modification is as follows:

1.4. Modify the contents of the project. Copy the contents under WebContent to/src/main/webapp, and then delete the WebContent directory, and the modified results are as follows:

1.5. Add "Server Runtime" and add the following results:

Ii. Creating databases and tables

Third, add dependency

Iv. New Pojo entity layer

V. New MyBatis SQL mapping layer

Vi. Creating a service layer

VII. complete Spring Integrated mybatis configuration

Viii. creating Servlets and implementing features

Nine, Test run

Spring Integrated MyBatis Complete Example

Related Article

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.