Binding to services

During boot, the applications were not able to connect with the required services. The problem occurs because services are not bound by default to the applications. You can display all of the services created in your space by running the command cf services, and bind each of them to a given microservice by invoking the command cf bind-service. In the following example command's executions, we have bound Eureka, configuration server, and MongoDB to account-service. Finally, we can run cf restage once more and everything should work fine, shown as follows:

$ cf bind-service account-service discovery-service$ cf bind-service account-service config-service$ cf bind-service account-service sample-db

Get Mastering Spring Cloud now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.