The following properties are applied to the Spring Data JPA configuration of using Postgres as its DBSM.
Two configuration files will be modified to achieve the goal.
- pom.xml
We need to add the PostgreSQL's dependency to your dependency list.
<dependencies>
...
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
...
</dependencies>
- application.properties
This file is usually located in themain/resources/
folder.
# Postgres
spring.datasource.driverClassName=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost:5432/test
spring.datasource.username=postgres
spring.datasource.password=postgres
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=none
spring.jpa.show-sql: true
# Connection pool
spring.datasource.hikari.connectionTimeout=20000
spring.datasource.hikari.maximumPoolSize=5