Skip to content

Instantly share code, notes, and snippets.

@bastienapp
Last active July 10, 2023 10:07
Show Gist options
  • Save bastienapp/1c5cca6b66c3271581a829a2843b16b9 to your computer and use it in GitHub Desktop.
Save bastienapp/1c5cca6b66c3271581a829a2843b16b9 to your computer and use it in GitHub Desktop.
Up to date Spring Data JPA application.properties (11-2022)
# ===============================
# = DATA SOURCE
# ===============================
# remove this line from application-dev.properties
spring.profiles.active=dev
# Set here configurations for the database connection
# Connection url for the database "dbname"
spring.datasource.url=jdbc:mysql://localhost:3306/dbname
# Username and password
spring.datasource.username=dbusername
spring.datasource.password=dbpassword
# Keep the connection alive if idle for a long time (needed in production)
spring.datasource.tomcat.test-while-idle=true
spring.datasource.tomcat.validation-query=SELECT 1
# ===============================
# = SPRING DATA JPA
# ===============================
# Use spring.jpa.properties.* for Hibernate native properties (the prefix is
# stripped before adding them to the entity manager).
# Synchronize Hibernate time zone with MySQL
spring.jpa.properties.hibernate.jdbc.time_zone=Europe/Paris
# Show or not log for each sql query
spring.jpa.show-sql=true
# Hibernate ddl auto (create, create-drop, update): with "update" the database
# schema will be automatically updated accordingly to java entities found in
# the project
spring.jpa.hibernate.ddl-auto=update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment