Skip to content

javayh swagger starter 说明

haiji.yang edited this page May 6, 2020 · 4 revisions

javayh-swagger-starter 说明

javayh-swagger-starter是本项目API文档管理中心

一.使用方式

1.1 依赖引入

这里以Demo案例为编写条件

<?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">
    <parent>
        <artifactId>javayh-demo</artifactId>
        <groupId>com.javayh</groupId>
        <version>1.0.0</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>javayh-demo-api</artifactId>

    <dependencies>
        <dependency>
            <groupId>com.javayh</groupId>
            <artifactId>javayh-swagger-starter</artifactId>
            <optional>true</optional>
        </dependency>
    </dependencies>
</project>

依赖引入后,即可计入开发阶段

1.2 启动类配置

需要在启动配添加 @EnableAutoSwagger注解

案例如下:

@EnableAutoSwagger
@JavayhBootApplication
public class ApiApplication {

	public static void main(String[] args) {
		SpringApplication.run(ApiApplication.class, args);
	}
}

启动项目进行api文档访问:ip:port/doc.html

swagger展示

关于swagger与gateway配置详情查看 https://github.com/Dylan-haiji/javayh-platform/blob/master/javayh-route/javayh-api-gateway/src/main/resources/bootstrap.yml

......未完待续......