I am trying to follow this tutorial https://github.com/cf-platform-eng/spring-boot-cities/tree/master/cities-service to run my spring boot application in Cloud Foundry. I have l
If you include spring-boot-starter-cloud-connectors
as a dependency, then Spring Cloud Connectors will attempt to create the java.sql.DataSource
bean necessary to connect to the database. Connectors does this by looking for a service binding that has certain characteristics. The No unique service matching interface javax.sql.DataSource found
message means that Connectors couldn't find a service binding of the appropriate type.
If you want to use Connectors as in that sample app then you will need to create a user-provided service instance with the details of the Postgres connection and bind that service instance to the app.
Alternatively, you could remove the spring-boot-starter-cloud-connectors
dependency and instead configure the database connection using spring.datasource
properties in application.yml
.
These options are explained in more detail in a blog post.
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.
Steps 3 and 4 were the mistakes i made. Once corrected the application works fine.
Best Regards, Saurav