I would like to define RestTemplate in a common place and want to re-use them wherever is required via Annotation
- How to configure RestTemplate in Spring 4.0 ?
- Which place is the right one to declare RestTemplate in WebMVCConfig or generic place?
- Do we need to create RestTemplate whenever required, and Http request has to be set everytime?
I come across this page - Basic authentication for REST API using spring restTemplate
Basically my username, password is not going to change. However URL will get change.
I would like to define in a common place. Please help me
Thanks
Tried with RestTemplate restTemplate = new RestTemplate() and it works