swagger接口文档
This commit is contained in:
parent
0d713dacd4
commit
07906093d3
@ -88,6 +88,17 @@
|
|||||||
<artifactId>base-trace</artifactId>
|
<artifactId>base-trace</artifactId>
|
||||||
<version>${frog.version}</version>
|
<version>${frog.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 公共模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.agri</groupId>
|
||||||
|
<artifactId>base-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
|
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -38,7 +38,6 @@ public class SwaggerConfig
|
|||||||
@Value("${swagger.enabled}")
|
@Value("${swagger.enabled}")
|
||||||
private boolean enabled;
|
private boolean enabled;
|
||||||
|
|
||||||
/** 设置请求的统一前缀 */
|
|
||||||
@Value("${swagger.pathMapping}")
|
@Value("${swagger.pathMapping}")
|
||||||
private String pathMapping;
|
private String pathMapping;
|
||||||
|
|
||||||
@ -58,7 +57,7 @@ public class SwaggerConfig
|
|||||||
// 扫描所有有注解的api,用这种方式更灵活
|
// 扫描所有有注解的api,用这种方式更灵活
|
||||||
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||||
// 扫描指定包中的swagger注解
|
// 扫描指定包中的swagger注解
|
||||||
// .apis(RequestHandlerSelectors.basePackage("com.agri.project.tool.swagger"))
|
// .apis(RequestHandlerSelectors.basePackage("com.agri.web"))
|
||||||
// 扫描所有 .apis(RequestHandlerSelectors.any())
|
// 扫描所有 .apis(RequestHandlerSelectors.any())
|
||||||
.paths(PathSelectors.any())
|
.paths(PathSelectors.any())
|
||||||
.build()
|
.build()
|
||||||
@ -113,9 +112,9 @@ public class SwaggerConfig
|
|||||||
// 用ApiInfoBuilder进行定制
|
// 用ApiInfoBuilder进行定制
|
||||||
return new ApiInfoBuilder()
|
return new ApiInfoBuilder()
|
||||||
// 设置标题
|
// 设置标题
|
||||||
.title("标题:frog接口文档")
|
.title("标题:总后台接口文档")
|
||||||
// 描述
|
// 描述
|
||||||
.description("描述:青蛙农业")
|
.description("描述:智慧农业")
|
||||||
// 作者信息
|
// 作者信息
|
||||||
.contact(new Contact(ruoyiConfig.getName(), null, null))
|
.contact(new Contact(ruoyiConfig.getName(), null, null))
|
||||||
// 版本
|
// 版本
|
||||||
|
@ -21,7 +21,7 @@ server:
|
|||||||
port: 18080
|
port: 18080
|
||||||
servlet:
|
servlet:
|
||||||
# 应用的访问路径
|
# 应用的访问路径
|
||||||
context-path: /
|
context-path: /admin
|
||||||
tomcat:
|
tomcat:
|
||||||
# tomcat的URI编码
|
# tomcat的URI编码
|
||||||
uri-encoding: UTF-8
|
uri-encoding: UTF-8
|
||||||
|
@ -2,3 +2,14 @@
|
|||||||
spring:
|
spring:
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: dev
|
||||||
|
|
||||||
|
knife4j:
|
||||||
|
enable: true
|
||||||
|
# 配置认证功能
|
||||||
|
basic:
|
||||||
|
# 是否开启认证
|
||||||
|
enable: true
|
||||||
|
# 用户名
|
||||||
|
username: admin
|
||||||
|
# 密码
|
||||||
|
password: admin123
|
||||||
|
@ -125,6 +125,18 @@
|
|||||||
<artifactId>javax.servlet-api</artifactId>
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Swagger3依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-boot-starter</artifactId>
|
||||||
|
<version>${swagger.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-models</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
@ -13,10 +13,10 @@ import org.springframework.stereotype.Component;
|
|||||||
public class RuoYiConfig
|
public class RuoYiConfig
|
||||||
{
|
{
|
||||||
/** 项目名称 */
|
/** 项目名称 */
|
||||||
private String name;
|
private static String name;
|
||||||
|
|
||||||
/** 版本 */
|
/** 版本 */
|
||||||
private String version;
|
private static String version;
|
||||||
|
|
||||||
/** 版权年份 */
|
/** 版权年份 */
|
||||||
private String copyrightYear;
|
private String copyrightYear;
|
||||||
@ -33,7 +33,7 @@ public class RuoYiConfig
|
|||||||
/** 验证码类型 */
|
/** 验证码类型 */
|
||||||
private static String captchaType;
|
private static String captchaType;
|
||||||
|
|
||||||
public String getName()
|
public static String getName()
|
||||||
{
|
{
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ public class RuoYiConfig
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVersion()
|
public static String getVersion()
|
||||||
{
|
{
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
5
pom.xml
5
pom.xml
@ -115,6 +115,11 @@
|
|||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
|
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||||
|
<version>3.0.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- io常用工具类 -->
|
<!-- io常用工具类 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user