Why can't my Java Spring app cannot connect to my database?
Set your JDBC database URL as a system property such as
-Dspring.datasource.url=jdbc:postgresql://... in your
Procfile. This takes precedence over other forms of configuration including environment variables and configuration files.
The official Heroku buildpacks for Java and Gradle will attempt to create
SPRING_DATASOURCE_PASSWORD environment variables when a dyno starts up. These variables will override configuration in your
application.properties files, which can interfere with you app's ability to connect to your database.