I am using Spring Cloud Connector to bind to databases. Is there any way to get the plan of the bound service? When I extend an AbstractCloudConfig and do
cloud().getSingletonServiceInfosByType(PostgresqlServiceInfo.class)...
I will have information on the url and how to connect to the postgres. PostgresqlServiceInfo and others do not carry along the plan data. How can I extend the service info, in order to read this information form VCAP_SERVICES?
Thanks
By design, the
ServiceInfoclasses in Spring Cloud Connectors carry just enough information to create the connection beans necessary for an app to consume the service resources. Connectors was designed to be platform-neutral, and fields likeplan,label, andtagsthat are available on Cloud Foundry are not captured because they might not be available on other platforms (e.g. Heroku).To add the
planinformation to aServiceInfo, you'd need to write your ownServiceInfoclass that includes a field for the value, then write aCloudFoundryServiceInfoCreatorto populate the value from theVCAP_SERVICESdata that the framework provides as aMap. See the project documentation for more information on creating such an extension.Another (likely easier) option is to use the newer
java-cfenvproject instead of Spring Cloud Connectors.java-cfenvsupports Cloud Foundry only, and gives access to the full set of information inVCAP_SERVICES. See the project documentation for an example of how you can use this library.