Skip to content

Instantly share code, notes, and snippets.

@zubayerahamed
Created December 8, 2018 16:28
Show Gist options
  • Save zubayerahamed/b49f958928e2c77cdda5626a98dfcfd3 to your computer and use it in GitHub Desktop.
Save zubayerahamed/b49f958928e2c77cdda5626a98dfcfd3 to your computer and use it in GitHub Desktop.
Postgresql database configuration for Spring Boot app
# Set here configurations for the database connection
spring.datasource.platform=postgres
spring.datasource.url= jdbc:postgresql://localhost:5432/postgres
spring.datasource.username=postgres
spring.datasource.password=**_password_**
spring.datasource.driver-class-name=org.postgresql.Driver
# Keep the connection alive if idle for a long time (need in production)
spring.datasource.dbcp2.test-while-idle=true
spring.datasource.dbcp2.validation-query=SELECT 1
# JPA / Hibernate
spring.jpa.show-sql=true
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=update
# Naming strategy
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
# Allow hibernate to generate SQL optimized for a partucular DBMS
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQL95Dialect
# Disable PgConnection createClob() for postgres
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment