spring boot api project seed
基础精简完善版
Spring Boot API Project Seed is a seed project based on Spring Boot & MyBatis. It is used to quickly build small and medium-sized API and RESTful API projects. This seed project has been practiced in many real projects. It is stable, simple and fast, allowing us to get rid of For those repetitive tasks, focus on writing business code and reduce overtime. The following is a simple usage demonstration to see how to implement a simple API in just a few dozen seconds based on this project and run it to provide services.
CodeGenerator.genController(tableName)
method. The POST template is used by default. Code templates can be expanded according to the needs of actual projects. Since each company's business is different, we only provide some relatively basic and common templates. The main purpose is to provide an idea to reduce the writing of repeated code. In actual projects, I In use, a large number of templates are actually written based on the abstraction of the company's business. In addition, using templates can also help keep the team's coding style unified.CodeGenerator
in the test
package, mainly JDBC, because the code needs to be generated based on the table namedemo-user.sql
in the test resources
directory, otherwise ignore this stepCodeGenerator.main()
method to generate basic code (you may need to refresh the project directory to come out)application-dev.properties
, start the project, Have Fun! @Transient
annotation to the extended member variables. For details, see the general Mapper plug-in documentation.ServiceException("message")
, and the unified exception processor will encapsulate the response result of business failure, such as throw new ServiceException("该手机号已被注册")
, which will be directly encapsulated as {"code":400,"message":"该手机号已被注册"}
returns, no need to handle it yourself, just throw it as much as you likeapache-commons-*
and guava
first. There is really no need to reinvent the wheel or introduce class libraries. Try to streamline the project.None, purely open source sharing, thank you all Star & Fork for your support.