2

Is it possible to refresh property(api-url) through POST rest api /refresh call using @RefreshScope without having setup of spring cloud config server and spring cloud config client setup.

for.e.g Consumer.java

@Service public class Consumer { @value(${api-url}) private String apiUrl; 

api-url is getting read from application.yml now. I want to change the api-url at runtime without restarting server.

Is it possible in spring boot?

1 Answer 1

0

Yes, just include spring cloud starter

<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.2.RELEASE</version> </parent> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>Dalston.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter</artifactId> </dependency> </dependencies> 
Sign up to request clarification or add additional context in comments.

1 Comment

It works for property but if i change spring.active.profile in application.yml, the required property value is not getting loaded from spring.active.profile. I will post new question related to that.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.