|
|
@@ -9,11 +9,13 @@ 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 org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
|
|
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
@Configuration
|
|
|
-public class OpenApiConfig {
|
|
|
+public class OpenApiConfig implements WebMvcConfigurer {
|
|
|
|
|
|
@Value("${spring.application.name:Application}")
|
|
|
private String applicationName;
|
|
|
@@ -36,12 +38,15 @@ public class OpenApiConfig {
|
|
|
new Server()
|
|
|
.url("http://localhost:10120")
|
|
|
.description("开发环境"),
|
|
|
+ new Server()
|
|
|
+ .url("http://10.10.10.224:10014/")
|
|
|
+ .description("测试环境"),
|
|
|
new Server()
|
|
|
.url("https://api.payment.example.com")
|
|
|
.description("生产环境")
|
|
|
));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@Bean
|
|
|
public GroupedOpenApi paymentApi() {
|
|
|
return GroupedOpenApi.builder()
|
|
|
@@ -49,4 +54,38 @@ public class OpenApiConfig {
|
|
|
.packagesToScan("com.sckw.payment.controller")
|
|
|
.build();
|
|
|
}
|
|
|
-}
|
|
|
+
|
|
|
+ @Bean
|
|
|
+ public GroupedOpenApi paymentAppApi() {
|
|
|
+ return GroupedOpenApi.builder()
|
|
|
+ .group("payment-app")
|
|
|
+ .packagesToScan("com.sckw.payment.controller.app")
|
|
|
+ .build();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Bean
|
|
|
+ public GroupedOpenApi paymentOperateApi() {
|
|
|
+ return GroupedOpenApi.builder()
|
|
|
+ .group("payment-operate")
|
|
|
+ .packagesToScan("com.sckw.payment.controller.operate")
|
|
|
+ .build();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Bean
|
|
|
+ public GroupedOpenApi paymentAllApi() {
|
|
|
+ return GroupedOpenApi.builder()
|
|
|
+ .group("payment-all")
|
|
|
+ .packagesToScan("com.sckw.payment.controller",
|
|
|
+ "com.sckw.payment.controller.app",
|
|
|
+ "com.sckw.payment.controller.operate")
|
|
|
+ .build();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
|
+ registry.addResourceHandler("/doc.html")
|
|
|
+ .addResourceLocations("classpath:/META-INF/resources/");
|
|
|
+ registry.addResourceHandler("/webjars/**")
|
|
|
+ .addResourceLocations("classpath:/META-INF/resources/webjars/");
|
|
|
+ }
|
|
|
+}
|