3
votes

i want to know is there any way to use spring cloud config client without spring boot in a spring web application. i want to use spring cloud config with @Value annotation and i don't like to use spring cloud server rest api in my web application i have tried what developers said in Spring Cloud Config Client Without Spring Boot link but it didn't work

2
actually this link wasn't helpful,because it's a open ended discussion and i want to use spring cloud config client as same as they said in spring cloud config official documentation - Arsalan Noghrehkar
The rest api is the way to do it without config client. - spencergibb

2 Answers

0
votes

Yes it's possible. You will have to add spring boot but don't have to really use it (we had it working in a non-springboot app). Check this code here https://github.com/4finance/micro-infra-spring/tree/master/micro-infra-spring-config . You don't need a config server then to use the properties. I don't have a code snippet for that but you would have to create manually a spring boot context in your just to make this work. Also check this answer - Spring Cloud Config Client Without Spring Boot . Even if you will make it work it doesn't mean that the ordering will be proper.

The suggested solution then is to actually use Spring Boot :)

0
votes

I provided an answer here : Spring Cloud Config Client Without Spring Boot that can help you. It's a working prototype to load property sources from Zookeeper using Spring Cloud Config Zookeeper in a webapplication without Spring Boot.