Example Kotlin project that uses java-cfenv-boot to to autoconfigure datasources from HSDP RDS service broker
The example is geared towards PostgreSQL. Other databases should be trivial to configure.
The HSDPPostgresEnvProcessor class demonstrates how to implement CfEnvProcessor in order to discover and use the service broker properties.
It's crucial to add your custom class to spring.factories. In this example the entry looks like:
io.pivotal.cfenv.spring.boot.CfEnvProcessor=com.terrakube.cfdemo.HSDPPostgresEnvProcessor
./mvnw package -DskipTests=true
Use the manifest.example.yml as template. The template assumes you have compiled with Java 11.
Once deployed you can navigate to the app and it will show a string
with the result of the PostgreSQL now()
method, confirming the app
is connected to your PostgreSQL database.
hello world: 11 Aug 2020 02:01:09PM
License is MIT