Watching configuration changes

The sample that has been discussed in the previous section loads the configuration on startup of the application. If you would like that configuration to be reloaded, you should send an HTTP POST to the /refresh endpoint. In order to examine how such a refresh would work for our application, we modify the fragment of application code responsible for creating some test data. Until now, it has been provided as a repository, @Bean, with some hardcoded in-memory objects. Take a look at the following code: 

@BeanCustomerRepository repository() {    CustomerRepository repository = new CustomerRepository();    repository.add(new Customer("John Scott", CustomerType.NEW)); repository.add(new Customer("Adam Smith", CustomerType.REGULAR)); ...

Get Mastering Spring Cloud now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.