Browse Source

spring-boot-demo-swagger-beauty 完成

pull/1/head
Yangkai.Shen 5 years ago
parent
commit
77df74b6e8
5 changed files with 171 additions and 0 deletions
  1. +25
    -0
      spring-boot-demo-swagger-beauty/.gitignore
  2. +61
    -0
      spring-boot-demo-swagger-beauty/pom.xml
  3. +25
    -0
      spring-boot-demo-swagger-beauty/src/main/java/com/xkcoding/swagger/beauty/SpringBootDemoSwaggerBeautyApplication.java
  4. +44
    -0
      spring-boot-demo-swagger-beauty/src/main/resources/application.yml
  5. +16
    -0
      spring-boot-demo-swagger-beauty/src/test/java/com/xkcoding/swagger/beauty/SpringBootDemoSwaggerBeautyApplicationTests.java

+ 25
- 0
spring-boot-demo-swagger-beauty/.gitignore View File

@@ -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/

+ 61
- 0
spring-boot-demo-swagger-beauty/pom.xml View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>spring-boot-demo-swagger-beauty</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>spring-boot-demo-swagger-beauty</name>
<description>Demo project for Spring Boot</description>

<parent>
<groupId>com.xkcoding</groupId>
<artifactId>spring-boot-demo</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<battcn.swagger.version>2.1.2-RELEASE</battcn.swagger.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.battcn</groupId>
<artifactId>swagger-spring-boot-starter</artifactId>
<version>${battcn.swagger.version}</version>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
</dependencies>

<build>
<finalName>spring-boot-demo-swagger-beauty</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>

+ 25
- 0
spring-boot-demo-swagger-beauty/src/main/java/com/xkcoding/swagger/beauty/SpringBootDemoSwaggerBeautyApplication.java View File

@@ -0,0 +1,25 @@
package com.xkcoding.swagger.beauty;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
* <p>
* 启动器
* </p>
*
* @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);
}
}

+ 44
- 0
spring-boot-demo-swagger-beauty/src/main/resources/application.yml View File

@@ -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,一般为程序内部错误

+ 16
- 0
spring-boot-demo-swagger-beauty/src/test/java/com/xkcoding/swagger/beauty/SpringBootDemoSwaggerBeautyApplicationTests.java View File

@@ -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() {
}

}

Loading…
Cancel
Save