I use Spring RestTemplate to consume other services in my local environment.
In production env for scalabilty i want to use a service registry like eureka and ribbon client.
I want to have a clean separation of my code from eureka and ribbon client so that i can run my services locally without the overhead of running a separate service for eureka , registering the services with eureka and also doing a lookup against eureka during orchestration.
I have used spring profile feature to separate out the code and configuration related local and production.
I am stuck at one point where I use RestTemplate to invoke other services.
I want to use the load balanced rest template for prod env and normal rest template for local service call.
I am having difficulty in injecting the type of RestTemplate based on my environment.
Can someone help me with the right way of injecting the RestTemplate so that my services can run locally as well as leverage service registry and ribbon client when running in Prod env without impacting the code.
Thanks, Sri