Browse Source

添加应用属性配置不存在时忽略

master
jianjun 5 years ago
parent
commit
d742209542
  1. 21
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/ApplicationConfig.java
  2. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/MqConfig.java
  3. 3
      epmet-gateway/src/main/java/com/epmet/GatewayApplication.java
  4. 1
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionServiceImpl.java

21
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;
}
}

3
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;
}

3
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) {

1
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;

Loading…
Cancel
Save