优化swagger 配置

This commit is contained in:
冷冷 2024-04-07 12:50:25 +08:00
parent 0e90c12696
commit 1af0c068b0
4 changed files with 15 additions and 1 deletions

View File

@ -22,7 +22,7 @@
<maven.compiler.target>1.8</maven.compiler.target>
<fastjson.version>1.2.83</fastjson.version>
<knife4j.version>3.0.3</knife4j.version>
<springdoc.version>1.8.0</springdoc.version>
<springdoc.version>1.6.9</springdoc.version>
<swagger.core.version>2.2.0</swagger.core.version>
<mybatis-plus.version>3.5.5</mybatis-plus.version>
<dynamic-ds.version>4.3.0</dynamic-ds.version>

View File

@ -69,5 +69,9 @@
<artifactId>spring-webmvc</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-core</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -16,10 +16,12 @@
package com.pig4cloud.pig.common.swagger.annotation;
import com.pig4cloud.pig.common.core.factory.YamlPropertySourceFactory;
import com.pig4cloud.pig.common.swagger.config.OpenAPIDefinitionImportSelector;
import com.pig4cloud.pig.common.swagger.support.SwaggerProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
import java.lang.annotation.*;
@ -35,6 +37,7 @@ import java.lang.annotation.*;
@Inherited
@EnableConfigurationProperties(SwaggerProperties.class)
@Import({ OpenAPIDefinitionImportSelector.class })
@PropertySource(value = "classpath:openapi-config.yaml", factory = YamlPropertySourceFactory.class)
public @interface EnablePigDoc {
/**

View File

@ -0,0 +1,7 @@
# swagger 配置
swagger:
enabled: true
title: Pig Swagger API
gateway: http://${GATEWAY-HOST:pig-gateway}:${GATEWAY-PORT:9999}
token-url: ${swagger.gateway}/auth/oauth2/token
scope: server