No unique service maching interface error in Spring Boot Cloud Foundry error

后端 未结 2 2095
情话喂你
情话喂你 2021-01-24 22:59

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

2条回答
  •  不知归路
    2021-01-24 23:01

    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.

提交回复
热议问题