Spring Cloud 微服务前后端分离后端脚手架 带源码 悠悠 2022-11-30 12:46 138阅读 0赞 # acelee-apb # 源码地址: [https://gitee.com/acelee723/acelee-apb][https_gitee.com_acelee723_acelee-apb] #### 介绍 #### 作为前后端分离项目后端spring cloud系列开发脚手架API for Project Base,包含注册中心、服务者、消费者、网关gateway,集成了swagger增强版knife4j在线文档,mybatis plus自动生成代码等等,可直接作为项目开发基础进行后端代码开发。 #### 软件架构 #### * Spring Boot (2.3.2.RELEASE) * Spring Cloud (Hoxton.SR6) * Spring Cloud Eureka * Spring Cloud Fegin * Spring Cloud Gateway * Mybatis-Plus (3.3.2) [文档][Link 1] * knife4j (2.0.4) [文档][Link 2] #### 工程说明 #### * acelee-apb * apb-bizcommon 提供者公用jar包 * apb-bizsercer 提供者 * apb-common 公用jar包 * apb-gateserver 网关 * apb-regserver 注册中心 * apb-webcommon 消费者公用jar包 * apb-webserver 消费者 * docs 文档 备注: * 提供者服务有新增的服务添加在apb-bizserver下面; * 消费者服务有新增的服务添加在apb-webserver下面; * 启动顺序:apb-regserver、apb-bizsercer下所有提供者、apb-webserver下所有消费者、apb-gateserver * 访问:http://localhost:9000/doc.html 查看api各个服务的接口文档 #### 代码生成 #### * 生成类:apb-bizcommon --> src/main/java/com/aceleeyy/apb/generator/AutoCreateBean.java * 生成操作: * 1)修改MySQL数据库地址,main()方法里的表名; * 2)右击执行main(),无报错日志即生成完毕; * 生成位置: * 1)apb-bizcommon --> model、mapper、service、serviceImpl * 2)apb-webcommon --> model * 完成一个表的增删查改: * 1)apb-bizsercer 新建一个controller继承BaseController,提供者即完成; * @RestController @RequestMapping("/users") public class UserController extends BaseController<TUser> { } * 2)apb-webserver 新建一个service继承BaseService,提供者服务即完成; * @FeignClient("basic-biz") public interface UserService extends BaseService<TUser> { String BASE_URI = "/users"; } 新建一个controller继承BaseController,消费者即完成; * @Api(tags = "用户管理") @RestController @RequestMapping("/users") public class UserController extends BaseController<TUser> { @Autowired private UserService service; @Override protected String uri() { return service.BASE_URI; } } * 3)启动之后,在文档上可看到增删查改以及列表接口; * ![在这里插入图片描述][watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2xhczcyMw_size_16_color_FFFFFF_t_70_pic_center] [https_gitee.com_acelee723_acelee-apb]: https://gitee.com/acelee723/acelee-apb [Link 1]: https://mybatis.plus/guide/quick-start.html [Link 2]: https://doc.xiaominfo.com/ [watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2xhczcyMw_size_16_color_FFFFFF_t_70_pic_center]: /images/20221123/77805967c379439ea9414e593f4441e9.png
还没有评论,来说两句吧...