移除了YAML中的重复组配置,保持Java Bean配置
This commit is contained in:
parent
26445b86f7
commit
2ca07a12aa
|
|
@ -13,3 +13,5 @@
|
||||||
/DEPLOYMENT.md
|
/DEPLOYMENT.md
|
||||||
/ERROR_CAPTURE_GUIDE.md
|
/ERROR_CAPTURE_GUIDE.md
|
||||||
/*.sql
|
/*.sql
|
||||||
|
/JDK21_UPGRADE_NOTES.md
|
||||||
|
/start-jdk21.sh
|
||||||
126
pom.xml
126
pom.xml
|
|
@ -14,17 +14,25 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>2.2.6.RELEASE</version>
|
<version>2.7.18</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>21</java.version>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>21</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>21</maven.compiler.target>
|
||||||
|
<maven.compiler.release>21</maven.compiler.release>
|
||||||
<skipTests>true</skipTests>
|
<skipTests>true</skipTests>
|
||||||
<log4j.version>2.17.1</log4j.version>
|
<log4j.version>2.17.1</log4j.version>
|
||||||
<logback.version>1.2.9</logback.version>
|
<logback.version>1.2.9</logback.version>
|
||||||
<shiro.version>1.12.0</shiro.version>
|
<shiro.version>1.12.0</shiro.version>
|
||||||
|
<!-- JDK 21兼容版本 -->
|
||||||
|
<lombok.version>1.18.34</lombok.version>
|
||||||
|
<mybatis.version>3.5.16</mybatis.version>
|
||||||
|
<druid.version>1.2.23</druid.version>
|
||||||
|
<mybatis-plus.version>3.5.7</mybatis-plus.version>
|
||||||
|
<!-- SpringDoc OpenAPI for Swagger替换SpringFox -->
|
||||||
|
<springdoc.version>1.8.0</springdoc.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!--Spring Boot Web Starter-->
|
<!--Spring Boot Web Starter-->
|
||||||
|
|
@ -50,19 +58,36 @@
|
||||||
<groupId>org.apache.shiro</groupId>
|
<groupId>org.apache.shiro</groupId>
|
||||||
<artifactId>shiro-spring</artifactId>
|
<artifactId>shiro-spring</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
|
<!-- 排除SpringFox相关依赖,使用SpringDoc OpenAPI替代 -->
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
|
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger2</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger-ui</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-boot-starter</artifactId>
|
||||||
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--druid-->
|
<!--druid-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>druid-spring-boot-starter</artifactId>
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
<version>1.1.21</version>
|
<version>${druid.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.30</version>
|
<version>${lombok.version}</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
@ -137,7 +162,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mybatis</groupId>
|
<groupId>org.mybatis</groupId>
|
||||||
<artifactId>mybatis</artifactId>
|
<artifactId>mybatis</artifactId>
|
||||||
<version>3.5.6</version>
|
<version>${mybatis.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- shiro -->
|
<!-- shiro -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
@ -145,6 +170,37 @@
|
||||||
<artifactId>shiro-spring</artifactId>
|
<artifactId>shiro-spring</artifactId>
|
||||||
<version>${shiro.version}</version>
|
<version>${shiro.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- Spring Boot validation starter (required for @Valid annotations) -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- SpringDoc OpenAPI 3 (替换SpringFox/Knife4j) -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springdoc</groupId>
|
||||||
|
<artifactId>springdoc-openapi-ui</artifactId>
|
||||||
|
<version>${springdoc.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- SpringDoc OpenAPI WebMVC支持 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springdoc</groupId>
|
||||||
|
<artifactId>springdoc-openapi-webmvc-core</artifactId>
|
||||||
|
<version>${springdoc.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- 临时依赖:SpringFox注解兼容(仅用于编译,将逐步迁移到SpringDoc) -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger2</artifactId>
|
||||||
|
<version>2.9.2</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- 临时依赖:Knife4j注解兼容 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
|
<artifactId>knife4j-annotations</artifactId>
|
||||||
|
<version>2.0.9</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<finalName>devops-api-gd</finalName>
|
<finalName>devops-api-gd</finalName>
|
||||||
|
|
@ -152,6 +208,62 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<jvmArguments>
|
||||||
|
--add-opens java.base/java.util=ALL-UNNAMED
|
||||||
|
--add-opens java.base/java.lang=ALL-UNNAMED
|
||||||
|
--add-opens java.base/java.lang.reflect=ALL-UNNAMED
|
||||||
|
--add-opens java.base/java.time=ALL-UNNAMED
|
||||||
|
--add-opens java.desktop/java.beans=ALL-UNNAMED
|
||||||
|
</jvmArguments>
|
||||||
|
<excludes>
|
||||||
|
<exclude>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
</exclude>
|
||||||
|
</excludes>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.12.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>21</source>
|
||||||
|
<target>21</target>
|
||||||
|
<release>21</release>
|
||||||
|
<annotationProcessorPaths>
|
||||||
|
<path>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>${lombok.version}</version>
|
||||||
|
</path>
|
||||||
|
</annotationProcessorPaths>
|
||||||
|
<compilerArgs>
|
||||||
|
<arg>--add-opens</arg>
|
||||||
|
<arg>java.base/java.util=ALL-UNNAMED</arg>
|
||||||
|
<arg>--add-opens</arg>
|
||||||
|
<arg>java.base/java.lang=ALL-UNNAMED</arg>
|
||||||
|
<arg>--add-opens</arg>
|
||||||
|
<arg>java.base/java.lang.reflect=ALL-UNNAMED</arg>
|
||||||
|
<arg>-Xlint:deprecation</arg>
|
||||||
|
<arg>-Xlint:unchecked</arg>
|
||||||
|
<arg>-Xlint:-options</arg>
|
||||||
|
</compilerArgs>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>3.2.5</version>
|
||||||
|
<configuration>
|
||||||
|
<argLine>
|
||||||
|
--add-opens java.base/java.util=ALL-UNNAMED
|
||||||
|
--add-opens java.base/java.lang=ALL-UNNAMED
|
||||||
|
--add-opens java.base/java.lang.reflect=ALL-UNNAMED
|
||||||
|
--add-opens java.base/java.time=ALL-UNNAMED
|
||||||
|
</argLine>
|
||||||
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ public class DevOpsApplication extends SpringBootServletInitializer implements A
|
||||||
log.info("====== 程 序:{} !", applicationName);
|
log.info("====== 程 序:{} !", applicationName);
|
||||||
log.info("====== 版本号:{} ", version);
|
log.info("====== 版本号:{} ", version);
|
||||||
log.info("====== 描 述:{} ", description);
|
log.info("====== 描 述:{} ", description);
|
||||||
|
log.info("====== Java环境:{}", getJavaVersionInfo());
|
||||||
log.info("====== 接口文档路径:/doc.html,账号:admin、密码:123456。注:如果乱码请指定VM -Dfile.encoding=UTF-8");
|
log.info("====== 接口文档路径:/doc.html,账号:admin、密码:123456。注:如果乱码请指定VM -Dfile.encoding=UTF-8");
|
||||||
log.info("====== Druid Monitor路径:/druid,账号:admin、密码:123456");
|
log.info("====== Druid Monitor路径:/druid,账号:admin、密码:123456");
|
||||||
|
|
||||||
|
|
@ -173,7 +174,7 @@ public class DevOpsApplication extends SpringBootServletInitializer implements A
|
||||||
private static boolean isJava9OrHigher() {
|
private static boolean isJava9OrHigher() {
|
||||||
try {
|
try {
|
||||||
String version = System.getProperty("java.version");
|
String version = System.getProperty("java.version");
|
||||||
// Java 8: 1.8.x, Java 9+: 9.x, 10.x, 11.x, etc.
|
// Java 8: 1.8.x, Java 9+: 9.x, 10.x, 11.x, 21.x, etc.
|
||||||
if (version.startsWith("1.8")) {
|
if (version.startsWith("1.8")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -186,7 +187,21 @@ public class DevOpsApplication extends SpringBootServletInitializer implements A
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("解析Java版本失败: " + System.getProperty("java.version"), e);
|
log.warn("解析Java版本失败: " + System.getProperty("java.version"), e);
|
||||||
}
|
}
|
||||||
return false; // 默认认为是Java 8
|
return true; // JDK 21环境下默认为true
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前Java版本信息
|
||||||
|
*/
|
||||||
|
private static String getJavaVersionInfo() {
|
||||||
|
try {
|
||||||
|
String version = System.getProperty("java.version");
|
||||||
|
String vendor = System.getProperty("java.vendor");
|
||||||
|
String vmName = System.getProperty("java.vm.name");
|
||||||
|
return String.format("Java %s (%s - %s)", version, vendor, vmName);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return "Java version unknown";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,114 @@
|
||||||
|
package com.chinaweal.youfool.devops.config;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.models.Components;
|
||||||
|
import io.swagger.v3.oas.models.OpenAPI;
|
||||||
|
import io.swagger.v3.oas.models.info.Contact;
|
||||||
|
import io.swagger.v3.oas.models.info.Info;
|
||||||
|
import io.swagger.v3.oas.models.info.License;
|
||||||
|
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||||
|
import org.springdoc.core.GroupedOpenApi;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SpringDoc OpenAPI 配置类 (替换SpringFox)
|
||||||
|
* @author itluck
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@ConditionalOnProperty(value = "swagger.enable", havingValue = "true")
|
||||||
|
public class SpringDocOpenApiConfig {
|
||||||
|
|
||||||
|
@Value("${applicationName}")
|
||||||
|
private String applicationName;
|
||||||
|
|
||||||
|
@Value("${version:1.0.0}")
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
@Value("${description:DevOps运维管理系统}")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Value("${license:Apache 2.0}")
|
||||||
|
private String license;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置OpenAPI基本信息
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public OpenAPI customOpenAPI() {
|
||||||
|
return new OpenAPI()
|
||||||
|
.info(new Info()
|
||||||
|
.title(applicationName)
|
||||||
|
.description(description)
|
||||||
|
.version(version)
|
||||||
|
.contact(new Contact()
|
||||||
|
.name("chinaweal")
|
||||||
|
.url("https://www.chinaweal.com.cn")
|
||||||
|
.email(""))
|
||||||
|
.license(new License()
|
||||||
|
.name(license)
|
||||||
|
.url("https://www.chinaweal.com.cn")))
|
||||||
|
.components(new Components()
|
||||||
|
.addSecuritySchemes("token", new SecurityScheme()
|
||||||
|
.type(SecurityScheme.Type.APIKEY)
|
||||||
|
.in(SecurityScheme.In.HEADER)
|
||||||
|
.name("token")
|
||||||
|
.description("令牌")));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组织架构模块API分组
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public GroupedOpenApi orgApi() {
|
||||||
|
return GroupedOpenApi.builder()
|
||||||
|
.group("组织架构")
|
||||||
|
.packagesToScan("com.chinaweal.youfool.devops.org")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运维报障模块API分组
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public GroupedOpenApi devopsApi() {
|
||||||
|
return GroupedOpenApi.builder()
|
||||||
|
.group("运维报障")
|
||||||
|
.packagesToScan("com.chinaweal.youfool.devops.repair")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 基础环境模块API分组
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public GroupedOpenApi basisApi() {
|
||||||
|
return GroupedOpenApi.builder()
|
||||||
|
.group("基础环境")
|
||||||
|
.packagesToScan("com.chinaweal.youfool.devops.base")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebSocket测试环境API分组
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public GroupedOpenApi websocketApi() {
|
||||||
|
return GroupedOpenApi.builder()
|
||||||
|
.group("WebSocket测试环境")
|
||||||
|
.packagesToScan("com.chinaweal.youfool.devops.websocket")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 领导分配模块API分组
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public GroupedOpenApi leaderAssignApi() {
|
||||||
|
return GroupedOpenApi.builder()
|
||||||
|
.group("领导分配")
|
||||||
|
.packagesToScan("com.chinaweal.youfool.devops.leaderassign")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,123 +0,0 @@
|
||||||
package com.chinaweal.youfool.devops.config;
|
|
||||||
|
|
||||||
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import springfox.documentation.builders.ApiInfoBuilder;
|
|
||||||
import springfox.documentation.builders.ParameterBuilder;
|
|
||||||
import springfox.documentation.builders.PathSelectors;
|
|
||||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
|
||||||
import springfox.documentation.schema.ModelRef;
|
|
||||||
import springfox.documentation.service.ApiInfo;
|
|
||||||
import springfox.documentation.service.Contact;
|
|
||||||
import springfox.documentation.service.Parameter;
|
|
||||||
import springfox.documentation.spi.DocumentationType;
|
|
||||||
import springfox.documentation.spring.web.plugins.Docket;
|
|
||||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author itluck
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
@EnableSwagger2
|
|
||||||
@EnableKnife4j
|
|
||||||
@ConditionalOnProperty(value = "swagger.enable", havingValue = "true")
|
|
||||||
public class SwaggerKnife4j {
|
|
||||||
@Value("${applicationName}")
|
|
||||||
private String applicationName;
|
|
||||||
@Value("${version}")
|
|
||||||
private String version;
|
|
||||||
@Value("${description}")
|
|
||||||
private String description;
|
|
||||||
@Value("${license}")
|
|
||||||
private String license;
|
|
||||||
|
|
||||||
@Bean("orgApi")
|
|
||||||
public Docket orgApi() {
|
|
||||||
ParameterBuilder tokenPar = new ParameterBuilder();
|
|
||||||
List<Parameter> headers = new ArrayList<>();
|
|
||||||
tokenPar.name("token").description("令牌").modelRef(new ModelRef("string")).parameterType("header").required(false).build();
|
|
||||||
headers.add(tokenPar.build());
|
|
||||||
return new Docket(DocumentationType.SWAGGER_2)
|
|
||||||
.enable(true)
|
|
||||||
.apiInfo(apiInfo())
|
|
||||||
.groupName("组织架构")
|
|
||||||
.select()
|
|
||||||
.apis(RequestHandlerSelectors.basePackage("com.chinaweal.youfool.devops.org"))
|
|
||||||
.paths(PathSelectors.any())
|
|
||||||
.build()
|
|
||||||
.globalOperationParameters(headers);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean("devopsApi")
|
|
||||||
public Docket devopsApi() {
|
|
||||||
//添加head参数start
|
|
||||||
ParameterBuilder tokenPar = new ParameterBuilder();
|
|
||||||
List<Parameter> headers = new ArrayList<>();
|
|
||||||
tokenPar.name("token").description("令牌").modelRef(new ModelRef("string")).parameterType("header").required(false).build();
|
|
||||||
headers.add(tokenPar.build());
|
|
||||||
return new Docket(DocumentationType.SWAGGER_2)
|
|
||||||
.enable(true)
|
|
||||||
.apiInfo(apiInfo())
|
|
||||||
.groupName("运维报障")
|
|
||||||
.select()
|
|
||||||
.apis(RequestHandlerSelectors.basePackage("com.chinaweal.youfool.devops.repair"))
|
|
||||||
.paths(PathSelectors.any())
|
|
||||||
.build()
|
|
||||||
.globalOperationParameters(headers);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean("basisApi")
|
|
||||||
public Docket basisApi() {
|
|
||||||
//添加head参数start
|
|
||||||
ParameterBuilder tokenPar = new ParameterBuilder();
|
|
||||||
List<Parameter> headers = new ArrayList<>();
|
|
||||||
tokenPar.name("token").description("令牌").modelRef(new ModelRef("string")).parameterType("header").required(false).build();
|
|
||||||
headers.add(tokenPar.build());
|
|
||||||
return new Docket(DocumentationType.SWAGGER_2)
|
|
||||||
.enable(true)
|
|
||||||
.apiInfo(apiInfo())
|
|
||||||
.groupName("基础环境")
|
|
||||||
.select()
|
|
||||||
.apis(RequestHandlerSelectors.basePackage("com.chinaweal.youfool.devops.base"))
|
|
||||||
.paths(PathSelectors.any())
|
|
||||||
.build()
|
|
||||||
.globalOperationParameters(headers);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean("websocketApi")
|
|
||||||
public Docket websocketApi() {
|
|
||||||
//添加head参数start
|
|
||||||
ParameterBuilder tokenPar = new ParameterBuilder();
|
|
||||||
List<Parameter> headers = new ArrayList<>();
|
|
||||||
tokenPar.name("token").description("令牌").modelRef(new ModelRef("string")).parameterType("header").required(false).build();
|
|
||||||
headers.add(tokenPar.build());
|
|
||||||
return new Docket(DocumentationType.SWAGGER_2)
|
|
||||||
.enable(true)
|
|
||||||
.apiInfo(apiInfo())
|
|
||||||
.groupName("WebSocket测试环境")
|
|
||||||
.select()
|
|
||||||
.apis(RequestHandlerSelectors.basePackage("com.chinaweal.youfool.devops.websocket"))
|
|
||||||
.paths(PathSelectors.any())
|
|
||||||
.build()
|
|
||||||
.globalOperationParameters(headers);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private ApiInfo apiInfo() {
|
|
||||||
return new ApiInfoBuilder()
|
|
||||||
.title(applicationName)
|
|
||||||
.description(description)
|
|
||||||
.termsOfServiceUrl("https://www.chinaweal.com.cn")
|
|
||||||
.version(version)
|
|
||||||
.contact(new Contact("chinaweal", "https://www.chinaweal.com.cn", ""))
|
|
||||||
.license(license)
|
|
||||||
.licenseUrl("https://www.chinaweal.com.cn")
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -14,6 +14,9 @@ spring:
|
||||||
url: jdbc:postgresql://172.22.80.157:5432/devops_gd
|
url: jdbc:postgresql://172.22.80.157:5432/devops_gd
|
||||||
username: devops_gd
|
username: devops_gd
|
||||||
password: ChinaWeal@2024
|
password: ChinaWeal@2024
|
||||||
|
main:
|
||||||
|
# Spring Boot 2.7+新增:允许循环依赖(临时修复,后续需重构代码消除循环依赖)
|
||||||
|
allow-circular-references: true
|
||||||
file:
|
file:
|
||||||
devopsDir: D:\chinaweal\gitea-code\youfool-project\youfool-devops\upload
|
devopsDir: D:\chinaweal\gitea-code\youfool-project\youfool-devops\upload
|
||||||
|
|
||||||
|
|
@ -32,6 +35,21 @@ applicationName: devOps
|
||||||
|
|
||||||
swagger:
|
swagger:
|
||||||
enable: true
|
enable: true
|
||||||
|
|
||||||
|
# SpringDoc OpenAPI 配置 (替换SpringFox)
|
||||||
|
springdoc:
|
||||||
|
api-docs:
|
||||||
|
enabled: true
|
||||||
|
path: /v3/api-docs
|
||||||
|
swagger-ui:
|
||||||
|
enabled: true
|
||||||
|
path: /swagger-ui.html
|
||||||
|
operations-sorter: alpha
|
||||||
|
tags-sorter: alpha
|
||||||
|
|
||||||
|
version: "1.0.0"
|
||||||
|
description: "DevOps运维管理系统API文档"
|
||||||
|
license: "Apache 2.0"
|
||||||
# 错误日志配置
|
# 错误日志配置
|
||||||
error-log:
|
error-log:
|
||||||
# 是否启用错误日志文件写入功能
|
# 是否启用错误日志文件写入功能
|
||||||
|
|
|
||||||
|
|
@ -32,3 +32,10 @@ dbWebhookKeys: 45d1bda2-c0b9-45c3-b640-be77f7a0726d,2eacc126-74d2-4360-a88e-369c
|
||||||
|
|
||||||
swagger:
|
swagger:
|
||||||
enable: false
|
enable: false
|
||||||
|
|
||||||
|
# SpringDoc OpenAPI 配置 (生产环境禁用)
|
||||||
|
springdoc:
|
||||||
|
api-docs:
|
||||||
|
enabled: false
|
||||||
|
swagger-ui:
|
||||||
|
enabled: false
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue