Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'api-host' in value "${

1问题Could not resolve placeholder 'api-host' in value :

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'api-host' in value "${

2.解决问题:

// 设置@Value注解取值不到忽略(不报错)
  @Bean
 public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() {
           PropertySourcesPlaceholderConfigurer c = new PropertySourcesPlaceholderConfigurer();
           c.setIgnoreUnresolvablePlaceholders(true);
           return c;
          }