Reputation: 187
I bind a postgresql service for two apps. They both update the database. Problem is that I use one of the app to create the tables(database schema) by using spring jdbc namespace. But since the other one is provisioned to use a different user name and password. It can not access the tables created by another one. Anyway cloudfoundry to provide the flexibility to resolve the issue?
Upvotes: 1
Views: 983
Reputation: 852
For Spring apps, this can be achieved by taking the advantage of "auto-reconfigure". CF detects the bean of class javax.sql.DataSource under certain conditions and then replace the properties such as username or password with values of provisioned ones. You can find very detailed instructions here: http://docs.cloudfoundry.com/frameworks/java/spring/spring.html
Therefore for your 2 apps you can both configure the datasource connection as the same format. As long as you bind the same postgresql service to these 2 apps, although CF will inject different values to both apps, they can access same table without any explicit configurations.
Upvotes: 1