Application local.properties

# Database Configuration (1)
spring.datasource.url= jdbc:mysql://localhost:3306/tutorials?useSSL=false&allowPublicKeyRetrieval=true
spring.datasource.username=tutorial_master
spring.datasource.password=tutorial

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect

# SQL Printing
spring.jpa.show-sql=true # (2)
spring.jpa.properties.hibernate.format_sql=true # (3)
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE # (4)

# Max database connections (5)
spring.datasource.maxActive=10

# Allow for batch inserts (6)
spring.jpa.properties.hibernate.jdbc.batch_size=500
spring.jpa.properties.hibernate.order_inserts=true
spring.jpa.properties.hibernate.order_updates=true

# DDL: none, validate, update, create, create-drop (7)
spring.jpa.hibernate.ddl-auto=create-drop

# Logging Levels (8)
logging.level.com.thomaswildetech=TRACE

# Logging Pattern
logging.pattern.console=%clr(%d %-7level %-60logger{36} Line %-5L %-40M - %msg%n)

# Allows for color logging
spring.output.ansi.enabled=always
  1. Database URL, username, and password are defined here. Note, for production, we can simply use a different profile.
  2. Shows hibernates SQL calls. Great for ensuring hibernate is performing as expected.
  3. Formats the SQL ouput in a readable format.
  4. Shows the inputs into the SQL prepared statements.
  5. Max database connections depending on frequency of user calls.
  6. Mostly for doing batch inserts through a job.
    • create-drop: Drops all tables before recreating them
    • create: Create new tables based on new entities created
    • update: Update statements based on new properties within entities
    • none: Fastest, no DDL executed
  7. Set logging levels for your any packages.