I am trying to split the configuration between Spring cloud clients with a Spring cloud configuration server that has a file repository:
@Configuration @EnableAutoConfiguration @EnableConfigServer public class ConfigServerApplication { public static void main(String[] args) { SpringApplication.run(ConfigServerApplication.class, args); } }
One of my Spring Cloud clients uses the test.foo
configuration defined on the configuration server and it is configured as shown below:
@SpringBootApplication @RestController public class HelloWorldServiceApplication { @Value("${test.foo}") private String foo; @RequestMapping(path = "/", method = RequestMethod.GET) @ResponseBody public String helloWorld() { return "Hello " + this.foo; } public static void main(String[] args) { SpringApplication.run(HelloWorldServiceApplication.class, args); } }
Despite this configuration, the Environment
in the Spring Cloud Client does not contain a test.foo
entry (cf java.lang.IllegalArgumentException: Could not resolve placeholder 'test.foo'
)
However, it works fine if I put the properties in the hello-world-service.yml
file in my file repository in the configuration file.
Maven dependencies on Spring Cloud Brixton.M5 and Spring Download 1.3.3.RELEASE with spring-cloud-starter-config
and spring-cloud-config-server
source share