Describe the bug Error using @loadbalanced restTemplate in @PostConstruct

Sample @Bean @LoadBalanced public RestTemplate restTemplate() { RestTemplate restTemplate = new RestTemplate(); return restTemplate; }

@PostConstruct public void init() { //use restTemplate }

Result java.net.UnknownHostException: micorservice-provider-user

Comment From: HolmesTest

Inject the RestTemplate in another class and then use it in the @PostConstruct method

Comment From: spencergibb

This is a known issue that you will need to work around. Use a different signal such as an application ready event rather than post construct.

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.