This article is a mirror article of machine translation, please click here to jump to the original article.

View: 12231|Reply: 1

[Source] SpringBoot quickly integrates with Mybatis (de-XML + common service)

[Copy link]
Posted on 9/6/2018 4:46:05 PM | | |
Specific steps

Thanks to the new features of Spring4, we can use @Autowired to inject generic dependencies.

General Mapper

In the MyBatis project, the dependency of the generic Mapper is introduced, and the other configuration remains unchanged.


General Service

BaseService can add commonly used CURD interface methods according to actual needs, such as:

How to use:

Inherit the generic Mapper from the Mapper interface and specify the generic as follows:

Inherit the generic Service in the Service implementation class, as follows:

Finally, the RestFul API is provided in the Controller, as follows:

Simple style, start experimenting.

Source code download

Source code address:https://github.com/yizhiwazi/spr ... boot-mybatis-common





Previous:Mybatis Generator is the most complete configuration and detailed explanation
Next:Java Guess the Numbers Game
Posted on 9/6/2018 7:16:22 PM |
Brother, keytool is a little wrong and I want to ask you, can you give me a contact information?
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com