mirror of
https://github.com/didi/KnowStreaming.git
synced 2026-01-05 04:50:55 +08:00
Swagger提示版本和POM中版本通过配置保持一致
This commit is contained in:
@@ -15,6 +15,7 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: kafkamanager
|
name: kafkamanager
|
||||||
|
version: @project.version@
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: dev
|
||||||
datasource:
|
datasource:
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: kafkamanager
|
name: kafkamanager
|
||||||
|
version: @project.version@
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: dev
|
||||||
datasource:
|
datasource:
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ public class ConfigUtils {
|
|||||||
@Value(value = "${custom.idc:cn}")
|
@Value(value = "${custom.idc:cn}")
|
||||||
private String idc;
|
private String idc;
|
||||||
|
|
||||||
@Value(value = "${spring.profiles.active}")
|
@Value(value = "${spring.profiles.active:dev}")
|
||||||
private String kafkaManagerEnv;
|
private String kafkaManagerEnv;
|
||||||
|
|
||||||
|
@Value(value = "${spring.application.version:unknown}")
|
||||||
|
private String applicationVersion;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.xiaojukeji.kafka.manager.web.config;
|
package com.xiaojukeji.kafka.manager.web.config;
|
||||||
|
|
||||||
|
import com.xiaojukeji.kafka.manager.service.utils.ConfigUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.web.servlet.config.annotation.*;
|
import org.springframework.web.servlet.config.annotation.*;
|
||||||
@@ -20,6 +22,9 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|||||||
@EnableWebMvc
|
@EnableWebMvc
|
||||||
@EnableSwagger2
|
@EnableSwagger2
|
||||||
public class SwaggerConfig implements WebMvcConfigurer {
|
public class SwaggerConfig implements WebMvcConfigurer {
|
||||||
|
@Autowired
|
||||||
|
private ConfigUtils configUtils;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||||
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
|
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
|
||||||
@@ -41,7 +46,7 @@ public class SwaggerConfig implements WebMvcConfigurer {
|
|||||||
return new ApiInfoBuilder()
|
return new ApiInfoBuilder()
|
||||||
.title("LogiKM接口文档")
|
.title("LogiKM接口文档")
|
||||||
.description("欢迎使用滴滴LogiKM")
|
.description("欢迎使用滴滴LogiKM")
|
||||||
.version("2.5.0")
|
.version(configUtils.getApplicationVersion())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: kafkamanager
|
name: kafkamanager
|
||||||
|
version: @project.version@
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: dev
|
||||||
datasource:
|
datasource:
|
||||||
|
|||||||
Reference in New Issue
Block a user