From d7422095428e72286ceee969ed94298f32e9888d Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 22 Jul 2020 14:12:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BA=94=E7=94=A8=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E9=85=8D=E7=BD=AE=E4=B8=8D=E5=AD=98=E5=9C=A8=E6=97=B6?= =?UTF-8?q?=E5=BF=BD=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/config/ApplicationConfig.java | 21 +++++++++++++++++++ .../epmet/commons/tools/config/MqConfig.java | 3 --- .../java/com/epmet/GatewayApplication.java | 3 +-- .../impl/CustomerFunctionServiceImpl.java | 1 - 4 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/ApplicationConfig.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/ApplicationConfig.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/ApplicationConfig.java new file mode 100644 index 0000000000..a16de46621 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/ApplicationConfig.java @@ -0,0 +1,21 @@ +package com.epmet.commons.tools.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; + +/** + * desc:应用配置 + * @author lyn + * @date 2020/7/22 14:08 + */ +@Configuration +public class ApplicationConfig { + // 设置@Value注解取值不到忽略(不报错) + @Bean + public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() { + PropertySourcesPlaceholderConfigurer c = new PropertySourcesPlaceholderConfigurer(); + c.setIgnoreUnresolvablePlaceholders(true); + return c; + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/MqConfig.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/MqConfig.java index 297c305a39..4d9acf91fa 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/MqConfig.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/MqConfig.java @@ -8,9 +8,7 @@ package com.epmet.commons.tools.config; -import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; @@ -27,7 +25,6 @@ public class MqConfig { private String appId; @Value("${elink.mq.token}") private String token; - @JsonIgnore @Value("${elink.mq.host}") private String host; } diff --git a/epmet-gateway/src/main/java/com/epmet/GatewayApplication.java b/epmet-gateway/src/main/java/com/epmet/GatewayApplication.java index 45db4f1a24..5c8d111813 100644 --- a/epmet-gateway/src/main/java/com/epmet/GatewayApplication.java +++ b/epmet-gateway/src/main/java/com/epmet/GatewayApplication.java @@ -9,7 +9,6 @@ package com.epmet; import com.epmet.commons.tools.aspect.ServletExceptionHandler; -import com.epmet.commons.tools.config.MqConfig; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; @@ -26,7 +25,7 @@ import org.springframework.context.annotation.FilterType; @SpringBootApplication() @EnableDiscoveryClient @EnableFeignClients -@ComponentScan(basePackages = {"com.epmet.*"}, excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {ServletExceptionHandler.class, MqConfig.class})) +@ComponentScan(basePackages = {"com.epmet.*"}, excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {ServletExceptionHandler.class})) public class GatewayApplication { public static void main(String[] args) { diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionServiceImpl.java index f2b3256b9e..7c68f32ec1 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionServiceImpl.java @@ -24,7 +24,6 @@ import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.CustomerFunctionConstant;