I'm using JHipster FeignClients for interservice communication. I want to change the hostname of my feignClient depending on my environment. If i try to build my application i get the following error:
org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'com.abcd.uaa.clients.ProductServiceClient' defined in null: Could not resolve placeholder 'application.productservice' in value "http://${application.productservice}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'application.productservice' in value "http://${application.productservice}"
If I'm running my build in the dev environment it seems to work, but my prod environment fails. My application is configured as followed:
UaaApp.class
@SpringBootApplication
@EnableFeignClients
@EnableConfigurationProperties({LiquibaseProperties.class, ApplicationProperties.class})
@EnableDiscoveryClient
public class UaaApp implements InitializingBean {...}
ApplicationProperties.java
@ConfigurationProperties(prefix = "application", ignoreUnknownFields = false)
public class ApplicationProperties {
private String productservice = "";
public String getProductservice() {
return productservice;
}
public void setProductservice(String productservice) {
this.productservice = productservice;
}
}
ProductServiceClient.java
@AuthorizedFeignClient(name = "productservice", decode404 = true, url = "${application.productservice}")
public interface ProductServiceClient {...}
application-dev.yml
application:
productservice: http://localhost:8082
application-prod.yml
application:
productservice: http://hostname:8082
Am I missing something?