Merge pull request #18 from weihubeats/add-spring-boot-nebula-all add get set
Merge pull request #18 from weihubeats/add-spring-boot-nebula-all
add get set
开箱即用的web模块
不使用spring-boot-nebula-web搭建项目
spring-boot-nebula-web
需要引入spring boot 各种依赖,指定各种版本,然后编写各种分页基础对象,Result返回对象 比如需要 原先web项目需要使用的返回值比如Response<T> ss;
Result
Response<T> ss
@GetMapping("/test") public Response<String> test() { return Response.success("小奏"); }
使用spring-boot-nebula-web搭建项目如何简单
引入依赖
<dependency> <groupId>io.github.weihubeats</groupId> <artifactId>spring-boot-nebula-web</artifactId> <version>0.0.01</version> </dependency>
编写一个启动类
@SpringBootApplication public class WebApplication { public static void main(String[] args) { TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai")); SpringApplication.run(WebApplication.class, args); } }
然后就可以愉快的写接口了,返回值无需使用Response包装,仅仅需要添加@NebulaResponseBody注解
Response
@NebulaResponseBody
@GetMapping("/test") @NebulaResponseBody public String test() { return "小奏"; }
返回结果
{ "code": 200, "data": "小奏", "msg": "success" }
spring boot
不使用spring-boot-nebula-dependencies可能存在的问题:
spring-boot-nebula-dependencies
boot-common-parent
web-spring-boot-start
LocalDateTime
mybatis-plus
ddd
使用参考 spring-boot-nebula-samples模块
运行Application.java
运行 http-test-controller.http中的GET localhost:8088/test
GET localhost:8088/test
现在不需要将自己的返回对象包裹起来,只需要添加注解@NebulaResponseBody
@GetTimestamp
@GetMapping("/test") @NebulaResponseBody public String test(@GetTimestamp LocalDateTime time) { return time.toString(); }
分布式锁
<dependency> <groupId>io.github.weihubeats</groupId> <artifactId>spring-boot-nebula-distribute-lock</artifactId> <version>0.0.01</version> </dependency>
ddd聚合根组件
<dependency> <groupId>io.github.weihubeats</groupId> <artifactId>spring-boot-nebula-aggregate</artifactId> <version>0.0.01</version> </dependency>
<dependency> <groupId>io.github.weihubeats</groupId> <artifactId>spring-boot-nebula-mybatis-plus</artifactId> <version>0.0.01</version> </dependency>
BaseDO
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
spring-boot-nebula
开箱即用的web模块
不使用
spring-boot-nebula-web
搭建项目需要引入spring boot 各种依赖,指定各种版本,然后编写各种分页基础对象,
Result
返回对象 比如需要 原先web项目需要使用的返回值比如Response<T> ss
;使用
spring-boot-nebula-web
搭建项目如何简单引入依赖
编写一个启动类
然后就可以愉快的写接口了,返回值无需使用
Response
包装,仅仅需要添加@NebulaResponseBody
注解返回结果
功能
spring boot
项目的依赖管理不使用
spring-boot-nebula-dependencies
可能存在的问题:spring-boot-nebula-dependencies
作为p’a’r’a’m 在boot-common-parent
管理公司的所有依赖,以后应用项目无需手动指定各种依赖版本只需引用依赖即可,统一在boot-common-parent
管理即可web-spring-boot-start
模块,解决web开发需要手动封装工具类的痛点LocalDateTime
注解mybatis-plus
模块ddd
聚合根模块demo
使用参考 spring-boot-nebula-samples模块
spring-boot-nebula-web 使用
引入依赖
运行Application.java
运行 http-test-controller.http中的
GET localhost:8088/test
现在不需要将自己的返回对象包裹起来,只需要添加注解
@NebulaResponseBody
提供开箱即用的分页对象
时间戳自动转
LocalDateTime
注解@GetTimestamp
依赖
分布式锁
ddd聚合根组件
mybatis-plus
模块说明
BaseDO
,一些常用的类型处理器,比如数组spring-boot-nebula-web-common