Just to summarize the overall solution for other readers.
If you have a scenario where you want to have a spring boot application talk to a database (hosted in other machine) and then run the application from cloud foundry. Then follow some of the tips below.
- Once you deploy your Spring Boot application and want to use Spring Boot cloud connector make sure you have all the proper dependencies in your classpath (spring-boot-cloud-connector and jar.
- If you want to bind a service instance with the application .Make sure the credentials adhere to this specification http://cloud.spring.io/spring-cloud-connectors/spring-cloud-cloud-foundry-connector.html#_postgresql
- In the service instance parameters make sure you use the uri parameter not depend on the username and password to construct the uri
- Make sure your database instance is actually running and you have created application service groups to allow outbound communication from your cloud foundry app. https://docs.cloudfoundry.org/concepts/asg.html#viewing
Steps 3 and 4 were the mistakes i made. Once corrected the application works fine.
Best Regards,
Saurav