|
@@ -0,0 +1,52 @@
|
|
|
|
|
+package com.sckw.payment.config;
|
|
|
|
|
+
|
|
|
|
|
+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.servers.Server;
|
|
|
|
|
+import org.springdoc.core.models.GroupedOpenApi;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
|
|
+import org.springframework.context.annotation.Configuration;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
|
|
+@Configuration
|
|
|
|
|
+public class OpenApiConfig {
|
|
|
|
|
+
|
|
|
|
|
+ @Value("${spring.application.name:Application}")
|
|
|
|
|
+ private String applicationName;
|
|
|
|
|
+
|
|
|
|
|
+ @Bean
|
|
|
|
|
+ public OpenAPI customOpenAPI() {
|
|
|
|
|
+ return new OpenAPI()
|
|
|
|
|
+ .info(new Info()
|
|
|
|
|
+ .title(applicationName + " API")
|
|
|
|
|
+ .version("1.0.0")
|
|
|
|
|
+ .description("钱包以及支付DOC文档 - 提供钱包管理以及支付等API接口")
|
|
|
|
|
+ .contact(new Contact()
|
|
|
|
|
+ .name("开物钱包开发团队")
|
|
|
|
|
+ .email("iot-dev@example.com")
|
|
|
|
|
+ .url("https://iot-platform.com"))
|
|
|
|
|
+ .license(new License()
|
|
|
|
|
+ .name("Apache 2.0")
|
|
|
|
|
+ .url("https://www.apache.org/licenses/LICENSE-2.0")))
|
|
|
|
|
+ .servers(List.of(
|
|
|
|
|
+ new Server()
|
|
|
|
|
+ .url("http://localhost:10120")
|
|
|
|
|
+ .description("开发环境"),
|
|
|
|
|
+ new Server()
|
|
|
|
|
+ .url("https://api.payment.example.com")
|
|
|
|
|
+ .description("生产环境")
|
|
|
|
|
+ ));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Bean
|
|
|
|
|
+ public GroupedOpenApi paymentApi() {
|
|
|
|
|
+ return GroupedOpenApi.builder()
|
|
|
|
|
+ .group("payment")
|
|
|
|
|
+ .packagesToScan("com.sckw.payment.controller")
|
|
|
|
|
+ .build();
|
|
|
|
|
+ }
|
|
|
|
|
+}
|