From d0c43311d569790fb839333e8f7aeb39e29d2158 Mon Sep 17 00:00:00 2001
From: ZhangHang <252861252@qq.com>
Date: Tue, 17 Aug 2021 14:23:40 +0800
Subject: [PATCH 1/3] springboot-undertow
---
springboot-nacos/api-core/.gitignore | 33 ++++++++++
springboot-nacos/api-core/pom.xml | 54 ++++++++++++++++
.../java/com/button/ApiCoreApplication.java | 13 ++++
.../src/main/resources/application.properties | 1 +
.../com/button/ApiCoreApplicationTests.java | 13 ++++
springboot-undertow/.gitignore | 33 ++++++++++
springboot-undertow/pom.xml | 63 +++++++++++++++++++
.../button/SpringBootUndertowApplication.java | 13 ++++
.../src/main/java/com/button/controller.java | 13 ++++
.../src/main/resources/application.yml | 9 +++
10 files changed, 245 insertions(+)
create mode 100644 springboot-nacos/api-core/.gitignore
create mode 100644 springboot-nacos/api-core/pom.xml
create mode 100644 springboot-nacos/api-core/src/main/java/com/button/ApiCoreApplication.java
create mode 100644 springboot-nacos/api-core/src/main/resources/application.properties
create mode 100644 springboot-nacos/api-core/src/test/java/com/button/ApiCoreApplicationTests.java
create mode 100644 springboot-undertow/.gitignore
create mode 100644 springboot-undertow/pom.xml
create mode 100644 springboot-undertow/src/main/java/com/button/SpringBootUndertowApplication.java
create mode 100644 springboot-undertow/src/main/java/com/button/controller.java
create mode 100644 springboot-undertow/src/main/resources/application.yml
diff --git a/springboot-nacos/api-core/.gitignore b/springboot-nacos/api-core/.gitignore
new file mode 100644
index 0000000..b56f1dd
--- /dev/null
+++ b/springboot-nacos/api-core/.gitignore
@@ -0,0 +1,33 @@
+README.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
diff --git a/springboot-nacos/api-core/pom.xml b/springboot-nacos/api-core/pom.xml
new file mode 100644
index 0000000..e8b8b97
--- /dev/null
+++ b/springboot-nacos/api-core/pom.xml
@@ -0,0 +1,54 @@
+
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.5.3
+
+
+ com.button
+ api-core
+ 0.0.1-SNAPSHOT
+ api-core
+ api-core
+
+ 1.8
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+
+ org.projectlombok
+ lombok
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ org.projectlombok
+ lombok
+
+
+
+
+
+
+
+
diff --git a/springboot-nacos/api-core/src/main/java/com/button/ApiCoreApplication.java b/springboot-nacos/api-core/src/main/java/com/button/ApiCoreApplication.java
new file mode 100644
index 0000000..9b609e3
--- /dev/null
+++ b/springboot-nacos/api-core/src/main/java/com/button/ApiCoreApplication.java
@@ -0,0 +1,13 @@
+package com.button;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class ApiCoreApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(ApiCoreApplication.class, args);
+ }
+
+}
diff --git a/springboot-nacos/api-core/src/main/resources/application.properties b/springboot-nacos/api-core/src/main/resources/application.properties
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/springboot-nacos/api-core/src/main/resources/application.properties
@@ -0,0 +1 @@
+
diff --git a/springboot-nacos/api-core/src/test/java/com/button/ApiCoreApplicationTests.java b/springboot-nacos/api-core/src/test/java/com/button/ApiCoreApplicationTests.java
new file mode 100644
index 0000000..cbed05f
--- /dev/null
+++ b/springboot-nacos/api-core/src/test/java/com/button/ApiCoreApplicationTests.java
@@ -0,0 +1,13 @@
+package com.button;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class ApiCoreApplicationTests {
+
+ @Test
+ void contextLoads() {
+ }
+
+}
diff --git a/springboot-undertow/.gitignore b/springboot-undertow/.gitignore
new file mode 100644
index 0000000..b56f1dd
--- /dev/null
+++ b/springboot-undertow/.gitignore
@@ -0,0 +1,33 @@
+README.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
diff --git a/springboot-undertow/pom.xml b/springboot-undertow/pom.xml
new file mode 100644
index 0000000..59018f1
--- /dev/null
+++ b/springboot-undertow/pom.xml
@@ -0,0 +1,63 @@
+
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.5.3
+
+
+ com.button
+ springboot-undertow
+ 0.0.1-SNAPSHOT
+ springboot-undertow
+ springboot-undertow
+
+ 1.8
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-undertow
+
+
+ org.projectlombok
+ lombok
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ org.projectlombok
+ lombok
+
+
+
+
+
+
+
+
diff --git a/springboot-undertow/src/main/java/com/button/SpringBootUndertowApplication.java b/springboot-undertow/src/main/java/com/button/SpringBootUndertowApplication.java
new file mode 100644
index 0000000..e691942
--- /dev/null
+++ b/springboot-undertow/src/main/java/com/button/SpringBootUndertowApplication.java
@@ -0,0 +1,13 @@
+package com.button;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class SpringBootUndertowApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(SpringBootUndertowApplication.class, args);
+ }
+
+}
diff --git a/springboot-undertow/src/main/java/com/button/controller.java b/springboot-undertow/src/main/java/com/button/controller.java
new file mode 100644
index 0000000..8b34e21
--- /dev/null
+++ b/springboot-undertow/src/main/java/com/button/controller.java
@@ -0,0 +1,13 @@
+package com.button;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class controller {
+
+ @GetMapping("/test")
+ public String get() {
+ return "Hello World!";
+ }
+}
diff --git a/springboot-undertow/src/main/resources/application.yml b/springboot-undertow/src/main/resources/application.yml
new file mode 100644
index 0000000..5fdf1a8
--- /dev/null
+++ b/springboot-undertow/src/main/resources/application.yml
@@ -0,0 +1,9 @@
+server:
+ port: 8808
+ undertow:
+ io-threads: 16 #设置IO线程数, 它主要执行非阻塞的任务,它们会负责多个连接, 默认设置每个CPU核心一个线程,不要设置过大,如果过大,启动项目会报错:打开文件数过多
+ worker-threads: 256 #阻塞任务线程池, 当执行类似servlet请求阻塞IO操作, undertow会从这个线程池中取得线程,它的值设置取决于系统线程执行任务的阻塞系数,默认值是IO线程数*8
+ buffer-size: 1024 # 以下的配置会影响buffer,这些buffer会用于服务器连接的IO操作,有点类似netty的池化内存管理,每块buffer的空间大小,越小的空间被利用越充分,不要设置太大,以免影响其他应用,合适即可
+ buffers-per-region: 1024 # 每个区分配的buffer数量 , 所以pool的大小是buffer-size * buffers-per-region
+ direct-buffers: true # 是否分配的直接内存(NIO直接分配的堆外内存)
+
--
Gitee
From 5f66e1cb7e9c214da77dc022abb87dd47d1d2613 Mon Sep 17 00:00:00 2001
From: ZhangHang <252861252@qq.com>
Date: Thu, 14 Jul 2022 15:47:26 +0800
Subject: [PATCH 2/3] =?UTF-8?q?=E9=9B=86=E6=88=90smartdoc?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Springboot-SmartDoc/.gitignore | 1 +
Springboot-SmartDoc/README.MD | 17 +++
Springboot-SmartDoc/common/pom.xml | 28 +++++
.../java/com/button/domain/ResultData.java | 118 ++++++++++++++++++
.../domain/request/SystemOneRequest.java | 21 ++++
.../domain/request/SystemTwoRequest.java | 21 ++++
.../domain/response/SystemOneResponse.java | 23 ++++
.../domain/response/SystemTwoResponse.java | 23 ++++
Springboot-SmartDoc/pom.xml | 55 ++++++++
Springboot-SmartDoc/system-one/pom.xml | 65 ++++++++++
.../systemone/SystemOneApplication.java | 16 +++
.../systemone/config/WebMvcAutoConfig.java | 33 +++++
.../controller/SystemOneController.java | 32 +++++
.../src/main/resources/application.yml | 2 +
.../src/main/resources/smart-doc.json | 44 +++++++
Springboot-SmartDoc/system-two/pom.xml | 65 ++++++++++
.../systemtwo/SystemTwoApplication.java | 16 +++
.../systemtwo/config/WebMvcAutoConfig.java | 33 +++++
.../controller/SystemTwoController.java | 32 +++++
.../src/main/resources/application.yml | 2 +
.../src/main/resources/smart-doc.json | 44 +++++++
21 files changed, 691 insertions(+)
create mode 100644 Springboot-SmartDoc/.gitignore
create mode 100644 Springboot-SmartDoc/README.MD
create mode 100644 Springboot-SmartDoc/common/pom.xml
create mode 100644 Springboot-SmartDoc/common/src/main/java/com/button/domain/ResultData.java
create mode 100644 Springboot-SmartDoc/common/src/main/java/com/button/domain/request/SystemOneRequest.java
create mode 100644 Springboot-SmartDoc/common/src/main/java/com/button/domain/request/SystemTwoRequest.java
create mode 100644 Springboot-SmartDoc/common/src/main/java/com/button/domain/response/SystemOneResponse.java
create mode 100644 Springboot-SmartDoc/common/src/main/java/com/button/domain/response/SystemTwoResponse.java
create mode 100644 Springboot-SmartDoc/pom.xml
create mode 100644 Springboot-SmartDoc/system-one/pom.xml
create mode 100644 Springboot-SmartDoc/system-one/src/main/java/com/button/systemone/SystemOneApplication.java
create mode 100644 Springboot-SmartDoc/system-one/src/main/java/com/button/systemone/config/WebMvcAutoConfig.java
create mode 100644 Springboot-SmartDoc/system-one/src/main/java/com/button/systemone/controller/SystemOneController.java
create mode 100644 Springboot-SmartDoc/system-one/src/main/resources/application.yml
create mode 100644 Springboot-SmartDoc/system-one/src/main/resources/smart-doc.json
create mode 100644 Springboot-SmartDoc/system-two/pom.xml
create mode 100644 Springboot-SmartDoc/system-two/src/main/java/com/button/systemtwo/SystemTwoApplication.java
create mode 100644 Springboot-SmartDoc/system-two/src/main/java/com/button/systemtwo/config/WebMvcAutoConfig.java
create mode 100644 Springboot-SmartDoc/system-two/src/main/java/com/button/systemtwo/controller/SystemTwoController.java
create mode 100644 Springboot-SmartDoc/system-two/src/main/resources/application.yml
create mode 100644 Springboot-SmartDoc/system-two/src/main/resources/smart-doc.json
diff --git a/Springboot-SmartDoc/.gitignore b/Springboot-SmartDoc/.gitignore
new file mode 100644
index 0000000..b83d222
--- /dev/null
+++ b/Springboot-SmartDoc/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/Springboot-SmartDoc/README.MD b/Springboot-SmartDoc/README.MD
new file mode 100644
index 0000000..1a8912a
--- /dev/null
+++ b/Springboot-SmartDoc/README.MD
@@ -0,0 +1,17 @@
+# 本案例主要实现SpringBoot多模块项目整合Smart-Doc
+```
+整合大致思路:
+1、pom中添加相关插件依赖
+2、编辑smart-doc.json文件
+3、使用命令生成
+4、如果生成的文档想要直接调用相关接口,必须添加CorsFilter
+```
+```
+特别注意:生成文档要求注释必须规范,否则会生成失败
+system-one项目生成文档
+mvn -X smart-doc:html -Dfile.encoding=UTF-8 -pl system-one -am
+system-two项目生成文档
+mvn -X smart-doc:html -Dfile.encoding=UTF-8 -pl system-two -am
+
+生成的路径可以再smart-doc.json中进行配置(outPath)
+```
\ No newline at end of file
diff --git a/Springboot-SmartDoc/common/pom.xml b/Springboot-SmartDoc/common/pom.xml
new file mode 100644
index 0000000..cf8a76a
--- /dev/null
+++ b/Springboot-SmartDoc/common/pom.xml
@@ -0,0 +1,28 @@
+
+
+
+ Springboot-SmartDoc
+ com.button
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ com.button
+ common
+ 1.0-SNAPSHOT
+
+
+ 8
+ 8
+
+
+
+
+ org.projectlombok
+ lombok
+ provided
+
+
+
\ No newline at end of file
diff --git a/Springboot-SmartDoc/common/src/main/java/com/button/domain/ResultData.java b/Springboot-SmartDoc/common/src/main/java/com/button/domain/ResultData.java
new file mode 100644
index 0000000..799a0af
--- /dev/null
+++ b/Springboot-SmartDoc/common/src/main/java/com/button/domain/ResultData.java
@@ -0,0 +1,118 @@
+package com.button.domain;
+
+import java.io.Serializable;
+
+/**
+ * 响应实体类
+ * @author button
+ * @Description
+ * @create 2022/7/14
+ */
+public class ResultData implements Serializable {
+ private static final long serialVersionUID = 1L;
+ public static final ErrorMsg SUCCESS = new ErrorMsg("success", "操作成功");
+ public static final ErrorMsg EXCEPTION = new ErrorMsg("exception", "系统忙,请稍后重试");
+ public static final ErrorMsg REQUEST_FAILED = new ErrorMsg("request.failed", "网络请求异常");
+ public static final ErrorMsg ERROR_NO_DATA = new ErrorMsg("error.no.data", "无数据");
+ public static final ErrorMsg ERROR_PARA_IS_NULL = new ErrorMsg("error.para.is.null", "请求参数PARA_NAME未设定");
+ /**
+ * 响应errorMsg实体
+ */
+ private ErrorMsg errorMsg;
+ /**
+ * 响应结果
+ */
+ private T data;
+ /**
+ * 响应时间
+ */
+ private Integer time;
+
+ public static ResultData ok(T data) {
+ ResultData result = new ResultData();
+ result.setErrorMsg(SUCCESS);
+ result.setData(data);
+ return result;
+ }
+
+ public static ResultData error(ErrorMsg error) {
+ ResultData result = new ResultData();
+ result.setErrorMsg(error);
+ return result;
+ }
+
+ public Integer getTime() {
+ return time;
+ }
+
+ public void setTime(Integer time) {
+ this.time = time;
+ }
+
+ public T getData() {
+ return data;
+ }
+
+ public void setData(T data) {
+ this.data = data;
+ }
+
+ public ErrorMsg getErrorMsg() {
+ return errorMsg;
+ }
+
+ public void setErrorMsg(ErrorMsg errorMsg) {
+ this.errorMsg = errorMsg;
+ }
+
+ public boolean isSuccessful() {
+ return SUCCESS.getCode().equals(this.errorMsg.getCode());
+ }
+
+ public boolean errorFor(ErrorMsg errMsg) {
+ return this.errorMsg.getCode().equalsIgnoreCase(errMsg.getCode());
+ }
+
+ public static class ErrorMsg implements Serializable {
+ private static final long serialVersionUID = -8899306544168830547L;
+ /**
+ * 响应code
+ */
+ private String code;
+ /**
+ * 响应信息
+ */
+ private String message;
+
+ public ErrorMsg(String code, String message) {
+ this.code = code;
+ this.message = message;
+ }
+
+ public String getCode() {
+ return this.code;
+ }
+
+ public String getMessage() {
+ return this.message;
+ }
+
+ public ErrorMsg setParam(String key, String value) {
+ return new ErrorMsg(this.code, this.message.replace(key, value));
+ }
+
+ public ErrorMsg withParam(String value) {
+ return setParam("PARA_NAME", value);
+ }
+
+ @Override
+ public String toString() {
+ return "[code=" + code + ", message=" + message + "]";
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "[errorMsg=" + errorMsg + ", data=" + data + "]";
+ }
+}
diff --git a/Springboot-SmartDoc/common/src/main/java/com/button/domain/request/SystemOneRequest.java b/Springboot-SmartDoc/common/src/main/java/com/button/domain/request/SystemOneRequest.java
new file mode 100644
index 0000000..9fde5f1
--- /dev/null
+++ b/Springboot-SmartDoc/common/src/main/java/com/button/domain/request/SystemOneRequest.java
@@ -0,0 +1,21 @@
+package com.button.domain.request;
+
+import lombok.Data;
+
+/**
+ * 系统1请求参数实体
+ * @author button
+ * @Description
+ * @create 2022/7/14
+ */
+@Data
+public class SystemOneRequest {
+ /**
+ * 姓名
+ */
+ private String name;
+ /**
+ * 地址
+ */
+ private String addr;
+}
diff --git a/Springboot-SmartDoc/common/src/main/java/com/button/domain/request/SystemTwoRequest.java b/Springboot-SmartDoc/common/src/main/java/com/button/domain/request/SystemTwoRequest.java
new file mode 100644
index 0000000..f6c060e
--- /dev/null
+++ b/Springboot-SmartDoc/common/src/main/java/com/button/domain/request/SystemTwoRequest.java
@@ -0,0 +1,21 @@
+package com.button.domain.request;
+
+import lombok.Data;
+
+/**
+ * 系统2请求参数实体
+ * @author button
+ * @Description
+ * @create 2022/7/14
+ */
+@Data
+public class SystemTwoRequest {
+ /**
+ * 姓名
+ */
+ private Integer age;
+ /**
+ * 性别
+ */
+ private String gender;
+}
diff --git a/Springboot-SmartDoc/common/src/main/java/com/button/domain/response/SystemOneResponse.java b/Springboot-SmartDoc/common/src/main/java/com/button/domain/response/SystemOneResponse.java
new file mode 100644
index 0000000..2eb0cac
--- /dev/null
+++ b/Springboot-SmartDoc/common/src/main/java/com/button/domain/response/SystemOneResponse.java
@@ -0,0 +1,23 @@
+package com.button.domain.response;
+
+import lombok.Builder;
+import lombok.Data;
+
+/**
+ * 系统1请求响应实体
+ * @author button
+ * @Description
+ * @create 2022/7/14
+ */
+@Data
+@Builder
+public class SystemOneResponse {
+ /**
+ * 姓名
+ */
+ private String name;
+ /**
+ * 地址
+ */
+ private String addr;
+}
diff --git a/Springboot-SmartDoc/common/src/main/java/com/button/domain/response/SystemTwoResponse.java b/Springboot-SmartDoc/common/src/main/java/com/button/domain/response/SystemTwoResponse.java
new file mode 100644
index 0000000..585fd1a
--- /dev/null
+++ b/Springboot-SmartDoc/common/src/main/java/com/button/domain/response/SystemTwoResponse.java
@@ -0,0 +1,23 @@
+package com.button.domain.response;
+
+import lombok.Builder;
+import lombok.Data;
+
+/**
+ * 系统2响应实体
+ * @author button
+ * @Description
+ * @create 2022/7/14
+ */
+@Data
+@Builder
+public class SystemTwoResponse {
+ /**
+ * 姓名
+ */
+ private Integer age;
+ /**
+ * 性别
+ */
+ private String gender;
+}
diff --git a/Springboot-SmartDoc/pom.xml b/Springboot-SmartDoc/pom.xml
new file mode 100644
index 0000000..ab3b4e1
--- /dev/null
+++ b/Springboot-SmartDoc/pom.xml
@@ -0,0 +1,55 @@
+
+
+ 4.0.0
+
+ com.button
+ Springboot-SmartDoc
+ 1.0-SNAPSHOT
+
+ common
+ system-one
+ system-two
+
+ pom
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.5.6
+
+
+
+
+ UTF-8
+ 8
+ 8
+
+
+
+
+
+
+
+ com.github.shalousun
+ smart-doc-maven-plugin
+ 2.4.8
+
+
+ ${basedir}/src/main/resources/smart-doc.json
+
+ ${project.artifactId}
+
+
+
+
+ html
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Springboot-SmartDoc/system-one/pom.xml b/Springboot-SmartDoc/system-one/pom.xml
new file mode 100644
index 0000000..449552c
--- /dev/null
+++ b/Springboot-SmartDoc/system-one/pom.xml
@@ -0,0 +1,65 @@
+
+
+
+ Springboot-SmartDoc
+ com.button
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ system-one
+ com.button
+ 1.0-SNAPSHOT
+
+
+ 8
+ 8
+
+
+
+
+ com.button
+ common
+ 1.0-SNAPSHOT
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+
+ system-one
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+ true
+ true
+
+
+
+ com.github.shalousun
+ smart-doc-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+ ${java.version}
+ ${java.version}
+ UTF-8
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Springboot-SmartDoc/system-one/src/main/java/com/button/systemone/SystemOneApplication.java b/Springboot-SmartDoc/system-one/src/main/java/com/button/systemone/SystemOneApplication.java
new file mode 100644
index 0000000..df7f4f1
--- /dev/null
+++ b/Springboot-SmartDoc/system-one/src/main/java/com/button/systemone/SystemOneApplication.java
@@ -0,0 +1,16 @@
+package com.button.systemone;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * @author button
+ * @Description
+ * @create 2022/7/14
+ */
+@SpringBootApplication
+public class SystemOneApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(SystemOneApplication.class, args);
+ }
+}
diff --git a/Springboot-SmartDoc/system-one/src/main/java/com/button/systemone/config/WebMvcAutoConfig.java b/Springboot-SmartDoc/system-one/src/main/java/com/button/systemone/config/WebMvcAutoConfig.java
new file mode 100644
index 0000000..405d11d
--- /dev/null
+++ b/Springboot-SmartDoc/system-one/src/main/java/com/button/systemone/config/WebMvcAutoConfig.java
@@ -0,0 +1,33 @@
+package com.button.systemone.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.cors.CorsConfiguration;
+import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
+import org.springframework.web.filter.CorsFilter;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+/**
+ * @author ZhangHang
+ * @Description
+ * @create 2022/5/20
+ */
+@Configuration
+public class WebMvcAutoConfig implements WebMvcConfigurer {
+
+ @Bean
+ public CorsFilter corsFilter() {
+ final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource();
+ final CorsConfiguration corsConfiguration = new CorsConfiguration();
+ /* 是否允许请求带有验证信息 */
+ corsConfiguration.setAllowCredentials(true);
+ /* 允许访问的客户端域名 */
+ corsConfiguration.addAllowedOriginPattern("*");
+ /* 允许服务端访问的客户端请求头 */
+ corsConfiguration.addAllowedHeader("*");
+ /* 允许访问的方法名,GET POST等 */
+ corsConfiguration.addAllowedMethod("*");
+ urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration);
+ return new CorsFilter(urlBasedCorsConfigurationSource);
+ }
+}
\ No newline at end of file
diff --git a/Springboot-SmartDoc/system-one/src/main/java/com/button/systemone/controller/SystemOneController.java b/Springboot-SmartDoc/system-one/src/main/java/com/button/systemone/controller/SystemOneController.java
new file mode 100644
index 0000000..8f2735e
--- /dev/null
+++ b/Springboot-SmartDoc/system-one/src/main/java/com/button/systemone/controller/SystemOneController.java
@@ -0,0 +1,32 @@
+package com.button.systemone.controller;
+
+import com.button.domain.ResultData;
+import com.button.domain.request.SystemOneRequest;
+import com.button.domain.response.SystemOneResponse;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 系统1测试接口
+ * @author button
+ * @Description 系统1测试接口
+ * @create 2022/7/14
+ */
+@RestController
+public class SystemOneController {
+
+ /**
+ * 系统1保存信息
+ * @Description: 系统1保存信息
+ * @author ZhangHang
+ * @param systemOneRequest 系统1保存信息请求实体
+ * @return com.button.domain.ResultData
+ * @date 2022/7/14 14:22
+ */
+ @PostMapping(value = "saveSysOneInfo")
+ public ResultData saveSysOneInfo(@RequestBody SystemOneRequest systemOneRequest){
+ SystemOneResponse systemOneResponse = SystemOneResponse.builder().name(systemOneRequest.getName()).addr(systemOneRequest.getAddr()).build();
+ return ResultData.ok(systemOneResponse);
+ }
+}
diff --git a/Springboot-SmartDoc/system-one/src/main/resources/application.yml b/Springboot-SmartDoc/system-one/src/main/resources/application.yml
new file mode 100644
index 0000000..54b155f
--- /dev/null
+++ b/Springboot-SmartDoc/system-one/src/main/resources/application.yml
@@ -0,0 +1,2 @@
+server:
+ port: 8081
\ No newline at end of file
diff --git a/Springboot-SmartDoc/system-one/src/main/resources/smart-doc.json b/Springboot-SmartDoc/system-one/src/main/resources/smart-doc.json
new file mode 100644
index 0000000..4210987
--- /dev/null
+++ b/Springboot-SmartDoc/system-one/src/main/resources/smart-doc.json
@@ -0,0 +1,44 @@
+{
+ "serverUrl": "http://127.0.0.1:9080",
+ "pathPrefix": "",
+ "isStrict": false,
+ "allInOne": true,
+ "outPath": "target/docs",
+ "coverOld": true,
+ "createDebugPage": true,
+ "packageFilters": "com.button.systemone.controller.*",
+ "md5EncryptedHtmlName": false,
+ "style":"atelier-cave-light",
+ "projectName": "systemone",
+ "framework": "spring",
+ "skipTransientField": true,
+ "sortByTitle":false,
+ "showAuthor":true,
+ "requestFieldToUnderline":false,
+ "responseFieldToUnderline":false,
+ "inlineEnum":true,
+ "recursionLimit":7,
+ "allInOneDocFileName":"systemone-doc.html",
+ "requestExample":"true",
+ "responseExample":"true",
+ "displayActualType":true,
+ "revisionLogs": [{
+ "version": "1.0",
+ "revisionTime": "2022-07-14 14:30",
+ "status": "update",
+ "author": "zhanghang",
+ "remarks": "系统1操作说明"
+ }],
+ "requestHeaders": [
+ {
+ "name": "token",
+ "type": "string",
+ "desc": "请求token,通过登录接口获取",
+ "value":"登录后获取token字符串",
+ "required": true
+ }
+ ],
+ "responseBodyAdvice":{
+ "className":"com.button.domain.ResultData"
+ }
+}
\ No newline at end of file
diff --git a/Springboot-SmartDoc/system-two/pom.xml b/Springboot-SmartDoc/system-two/pom.xml
new file mode 100644
index 0000000..24da002
--- /dev/null
+++ b/Springboot-SmartDoc/system-two/pom.xml
@@ -0,0 +1,65 @@
+
+
+
+ Springboot-SmartDoc
+ com.button
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ com.button
+ system-two
+ 1.0-SNAPSHOT
+
+
+ 8
+ 8
+
+
+
+
+ com.button
+ common
+ 1.0-SNAPSHOT
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+
+ system-two
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+ true
+ true
+
+
+
+ com.github.shalousun
+ smart-doc-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+ ${java.version}
+ ${java.version}
+ UTF-8
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Springboot-SmartDoc/system-two/src/main/java/com/button/systemtwo/SystemTwoApplication.java b/Springboot-SmartDoc/system-two/src/main/java/com/button/systemtwo/SystemTwoApplication.java
new file mode 100644
index 0000000..9bdd3fe
--- /dev/null
+++ b/Springboot-SmartDoc/system-two/src/main/java/com/button/systemtwo/SystemTwoApplication.java
@@ -0,0 +1,16 @@
+package com.button.systemtwo;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * @author button
+ * @Description
+ * @create 2022/7/14
+ */
+@SpringBootApplication
+public class SystemTwoApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(SystemTwoApplication.class, args);
+ }
+}
diff --git a/Springboot-SmartDoc/system-two/src/main/java/com/button/systemtwo/config/WebMvcAutoConfig.java b/Springboot-SmartDoc/system-two/src/main/java/com/button/systemtwo/config/WebMvcAutoConfig.java
new file mode 100644
index 0000000..9d68354
--- /dev/null
+++ b/Springboot-SmartDoc/system-two/src/main/java/com/button/systemtwo/config/WebMvcAutoConfig.java
@@ -0,0 +1,33 @@
+package com.button.systemtwo.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.cors.CorsConfiguration;
+import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
+import org.springframework.web.filter.CorsFilter;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+/**
+ * @author ZhangHang
+ * @Description
+ * @create 2022/5/20
+ */
+@Configuration
+public class WebMvcAutoConfig implements WebMvcConfigurer {
+
+ @Bean
+ public CorsFilter corsFilter() {
+ final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource();
+ final CorsConfiguration corsConfiguration = new CorsConfiguration();
+ /* 是否允许请求带有验证信息 */
+ corsConfiguration.setAllowCredentials(true);
+ /* 允许访问的客户端域名 */
+ corsConfiguration.addAllowedOriginPattern("*");
+ /* 允许服务端访问的客户端请求头 */
+ corsConfiguration.addAllowedHeader("*");
+ /* 允许访问的方法名,GET POST等 */
+ corsConfiguration.addAllowedMethod("*");
+ urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration);
+ return new CorsFilter(urlBasedCorsConfigurationSource);
+ }
+}
\ No newline at end of file
diff --git a/Springboot-SmartDoc/system-two/src/main/java/com/button/systemtwo/controller/SystemTwoController.java b/Springboot-SmartDoc/system-two/src/main/java/com/button/systemtwo/controller/SystemTwoController.java
new file mode 100644
index 0000000..bfbb9e8
--- /dev/null
+++ b/Springboot-SmartDoc/system-two/src/main/java/com/button/systemtwo/controller/SystemTwoController.java
@@ -0,0 +1,32 @@
+package com.button.systemtwo.controller;
+
+import com.button.domain.ResultData;
+import com.button.domain.request.SystemTwoRequest;
+import com.button.domain.response.SystemTwoResponse;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 系统2测试接口
+ * @author ZhangHang
+ * @Description 系统2测试接口
+ * @create 2022/7/14
+ */
+@RestController
+public class SystemTwoController {
+
+ /**
+ * 系统2保存信息
+ * @Description: 系统2保存信息
+ * @author ZhangHang
+ * @param systemTwoRequest 系统2保存信息请求实体
+ * @return com.button.domain.ResultData
+ * @date 2022/7/14 14:22
+ */
+ @PostMapping(value = "saveSysOneInfo")
+ public ResultData saveSysOneInfo(@RequestBody SystemTwoRequest systemTwoRequest){
+ SystemTwoResponse systemTwoResponse = SystemTwoResponse.builder().age(systemTwoRequest.getAge()).gender("男").build();
+ return ResultData.ok(systemTwoResponse);
+ }
+}
diff --git a/Springboot-SmartDoc/system-two/src/main/resources/application.yml b/Springboot-SmartDoc/system-two/src/main/resources/application.yml
new file mode 100644
index 0000000..0884131
--- /dev/null
+++ b/Springboot-SmartDoc/system-two/src/main/resources/application.yml
@@ -0,0 +1,2 @@
+server:
+ port: 8082
\ No newline at end of file
diff --git a/Springboot-SmartDoc/system-two/src/main/resources/smart-doc.json b/Springboot-SmartDoc/system-two/src/main/resources/smart-doc.json
new file mode 100644
index 0000000..d81e41e
--- /dev/null
+++ b/Springboot-SmartDoc/system-two/src/main/resources/smart-doc.json
@@ -0,0 +1,44 @@
+{
+ "serverUrl": "http://127.0.0.1:8082",
+ "pathPrefix": "",
+ "isStrict": false,
+ "allInOne": true,
+ "outPath": "target/docs",
+ "coverOld": true,
+ "createDebugPage": true,
+ "packageFilters": "com.button.systemtwo.controller.*",
+ "md5EncryptedHtmlName": false,
+ "style":"atelier-cave-light",
+ "projectName": "systemtwo",
+ "framework": "spring",
+ "skipTransientField": true,
+ "sortByTitle":false,
+ "showAuthor":true,
+ "requestFieldToUnderline":false,
+ "responseFieldToUnderline":false,
+ "inlineEnum":true,
+ "recursionLimit":7,
+ "allInOneDocFileName":"systemtwo-doc.html",
+ "requestExample":"true",
+ "responseExample":"true",
+ "displayActualType":true,
+ "revisionLogs": [{
+ "version": "1.0",
+ "revisionTime": "2022-07-14 14:30",
+ "status": "update",
+ "author": "button",
+ "remarks": "系统2操作说明"
+ }],
+ "requestHeaders": [
+ {
+ "name": "token",
+ "type": "string",
+ "desc": "请求token,通过登录接口获取",
+ "value":"登录后获取token字符串",
+ "required": true
+ }
+ ],
+ "responseBodyAdvice":{
+ "className":"com.button.domain.ResultData"
+ }
+}
\ No newline at end of file
--
Gitee
From 1980d84370ed6c4661278028a88bbe406f67962a Mon Sep 17 00:00:00 2001
From: ZhangHang <252861252@qq.com>
Date: Thu, 14 Jul 2022 15:50:04 +0800
Subject: [PATCH 3/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AF=B4=E6=98=8E?=
=?UTF-8?q?=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 6bcc1ef..e943d05 100644
--- a/README.md
+++ b/README.md
@@ -31,5 +31,5 @@ SpringBoot应用集合
- [springboot-pagehelper实现分页查询](https://gitee.com/superbutton/SpringBoot-Components/tree/develop/Springboot-pagehelper)
- [springboot-async实现异步](https://gitee.com/superbutton/SpringBoot-Components/tree/develop/springboot-async)
- [springboot-nacos注册中心](https://gitee.com/superbutton/SpringBoot-Components/tree/develop/springboot-nacos)
-
+- [springboot整合SmartDoc](https://gitee.com/superbutton/SpringBoot-Components/tree/develop/Springboot-SmartDoc)
--
Gitee