记录项目配置,修改配置项的获取方式
- new class ` CommonEnvPostProcessor ` - remove ` @value ` - make JwtUtil's method static
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package cn.celess.configuration;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import cn.celess.common.util.EnvironmentUtil;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
@@ -20,13 +20,10 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
@EnableSwagger2
|
||||
public class SwaggerConfig {
|
||||
|
||||
@Value("${spring.profiles.active}")
|
||||
private String environment;
|
||||
|
||||
@Bean
|
||||
public Docket createRestApi() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.enable(!"prod".equals(environment))
|
||||
.enable(!"prod".equals(EnvironmentUtil.getProperties("spring.profiles.active", "dev")))
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("cn.celess"))
|
||||
|
||||
Reference in New Issue
Block a user