From 77df74b6e8397f096bf60519e607b7896c1fef55 Mon Sep 17 00:00:00 2001 From: "Yangkai.Shen" <237497819@qq.com> Date: Wed, 28 Nov 2018 17:49:51 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20spring-boot-demo-swagger-beauty=20?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spring-boot-demo-swagger-beauty/.gitignore | 25 ++++++++ spring-boot-demo-swagger-beauty/pom.xml | 61 +++++++++++++++++++ ...pringBootDemoSwaggerBeautyApplication.java | 25 ++++++++ .../src/main/resources/application.yml | 44 +++++++++++++ ...BootDemoSwaggerBeautyApplicationTests.java | 16 +++++ 5 files changed, 171 insertions(+) create mode 100644 spring-boot-demo-swagger-beauty/.gitignore create mode 100644 spring-boot-demo-swagger-beauty/pom.xml create mode 100644 spring-boot-demo-swagger-beauty/src/main/java/com/xkcoding/swagger/beauty/SpringBootDemoSwaggerBeautyApplication.java create mode 100644 spring-boot-demo-swagger-beauty/src/main/resources/application.yml create mode 100644 spring-boot-demo-swagger-beauty/src/test/java/com/xkcoding/swagger/beauty/SpringBootDemoSwaggerBeautyApplicationTests.java diff --git a/spring-boot-demo-swagger-beauty/.gitignore b/spring-boot-demo-swagger-beauty/.gitignore new file mode 100644 index 0000000..82eca33 --- /dev/null +++ b/spring-boot-demo-swagger-beauty/.gitignore @@ -0,0 +1,25 @@ +/target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/build/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ \ No newline at end of file diff --git a/spring-boot-demo-swagger-beauty/pom.xml b/spring-boot-demo-swagger-beauty/pom.xml new file mode 100644 index 0000000..947d64d --- /dev/null +++ b/spring-boot-demo-swagger-beauty/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + spring-boot-demo-swagger-beauty + 1.0.0-SNAPSHOT + jar + + spring-boot-demo-swagger-beauty + Demo project for Spring Boot + + + com.xkcoding + spring-boot-demo + 1.0.0-SNAPSHOT + + + + UTF-8 + UTF-8 + 1.8 + 2.1.2-RELEASE + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + + com.battcn + swagger-spring-boot-starter + ${battcn.swagger.version} + + + + org.projectlombok + lombok + true + + + + + spring-boot-demo-swagger-beauty + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/spring-boot-demo-swagger-beauty/src/main/java/com/xkcoding/swagger/beauty/SpringBootDemoSwaggerBeautyApplication.java b/spring-boot-demo-swagger-beauty/src/main/java/com/xkcoding/swagger/beauty/SpringBootDemoSwaggerBeautyApplication.java new file mode 100644 index 0000000..6c23e90 --- /dev/null +++ b/spring-boot-demo-swagger-beauty/src/main/java/com/xkcoding/swagger/beauty/SpringBootDemoSwaggerBeautyApplication.java @@ -0,0 +1,25 @@ +package com.xkcoding.swagger.beauty; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + *

+ * 启动器 + *

+ * + * @package: com.xkcoding.swagger.beauty + * @description: 启动器 + * @author: yangkai.shen + * @date: Created in 2018-11-28 11:18 + * @copyright: Copyright (c) 2018 + * @version: V1.0 + * @modified: yangkai.shen + */ +@SpringBootApplication +public class SpringBootDemoSwaggerBeautyApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringBootDemoSwaggerBeautyApplication.class, args); + } +} diff --git a/spring-boot-demo-swagger-beauty/src/main/resources/application.yml b/spring-boot-demo-swagger-beauty/src/main/resources/application.yml new file mode 100644 index 0000000..48a33fa --- /dev/null +++ b/spring-boot-demo-swagger-beauty/src/main/resources/application.yml @@ -0,0 +1,44 @@ +server: + port: 8080 + servlet: + context-path: /demo +spring: + swagger: + enabled: true + title: spring-boot-demo + description: 这是一个简单的 Swagger API 演示 + version: 1.0.0-SNAPSHOT + contact: + name: Yangkai.Shen + email: 237497819@qq.com + url: http://xkcoding.com + # swagger扫描的基础包,默认:全扫描 + # base-package: + # 需要处理的基础URL规则,默认:/** + # base-path: + # 需要排除的URL规则,默认:空 + # exclude-path: + security: + # 是否启用 swagger 登录验证 + filter-plugin: true + username: xkcoding + password: 123456 + global-response-messages: + GET[0]: + code: 400 + message: Bad Request,一般为请求参数不对 + GET[1]: + code: 404 + message: NOT FOUND,一般为请求路径不对 + GET[2]: + code: 500 + message: ERROR,一般为程序内部错误 + POST[0]: + code: 400 + message: Bad Request,一般为请求参数不对 + POST[1]: + code: 404 + message: NOT FOUND,一般为请求路径不对 + POST[2]: + code: 500 + message: ERROR,一般为程序内部错误 diff --git a/spring-boot-demo-swagger-beauty/src/test/java/com/xkcoding/swagger/beauty/SpringBootDemoSwaggerBeautyApplicationTests.java b/spring-boot-demo-swagger-beauty/src/test/java/com/xkcoding/swagger/beauty/SpringBootDemoSwaggerBeautyApplicationTests.java new file mode 100644 index 0000000..ffba16e --- /dev/null +++ b/spring-boot-demo-swagger-beauty/src/test/java/com/xkcoding/swagger/beauty/SpringBootDemoSwaggerBeautyApplicationTests.java @@ -0,0 +1,16 @@ +package com.xkcoding.swagger.beauty; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class SpringBootDemoSwaggerBeautyApplicationTests { + + @Test + public void contextLoads() { + } + +}