- /hello
- Test-Endpoint to verify that RestController is working
- /random
- supposed to return Object of type
ChuckNorrisJokefrom https://api.chucknorris.io/jokes/random
- supposed to return Object of type
I set server.port=8080
So, for example, simply call http://localhost:8080/random
DynamicUrlConfiguration registers itself as a Listener for EmbeddedServletContainerInitializedEvent. In my real application I do that to have access to the real port number of my service. In this demo, I simply assign "https://api.chucknorris.io/jokes" to the configuration property the FeignClient (ChuckNorrisApiClient) uses as URL.
As one can see in the startup logs, this value indeed gets assigned to the property. But although calling refreshScope.refreshAll(), the FeignClient annotated with @RefreshScope does not get refreshed.
When you assign "https://api.chucknorris.io/jokes" to the property client.api-url in application.yml, the client works as expected. (Note that I received a 403 Error (Access denied | api.chucknorris.io used Cloudflare to restrict access) in the past. Nevertheless, the correct URL got called.)
I would expect the FeignClient to reload upon config changes.