Home > Back-end >  why RestTemplate cannot be auto-wired without specifying the bean creation configuration
why RestTemplate cannot be auto-wired without specifying the bean creation configuration

Time:06-22

I did not find reason as to why spring provided this approach. is it because, we can configure rest template as per application requirement, like setting up timeout...etc. then give it to spring? if not why ?

CodePudding user response:

Clearly justified in the documentation

Since RestTemplate instances often need to be customized before being used, Spring Boot does not provide any single auto-configured RestTemplate bean. It does, however, auto-configure a RestTemplateBuilder which can be used to create RestTemplate instances when needed

  • Related