Spring boot fails to load DataSource using PostgreSQL driver

spring.datasource.driver-class-name=org.postgresql.Driver

Make sure to reload your project if you recently just added postgres to your dependencies.


some time try re-import your mvn project if dependencies are not refreshed , also add following to your pom.xml

 <dependency>
            <groupId>postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>9.1-901.jdbc4</version>
</dependency>

Or to your build.gradle

implementation "postgresql:postgresql:9.1-901.jdbc4"

Where did this come from: database.driverClassName=org.postgresql.Driver? Don't you mean spring.datasource.driverClassName?