Very slow Spring Boot application startup Very slow Spring Boot application startup postgresql postgresql

Very slow Spring Boot application startup


For Spring Boot you can set this in your application.properties file:

spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false

I also found that I needed to set another property or I would get the error "org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set". To rectify that I set this property:

spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect

This reduced our startup time from about 100 seconds down to 12.


Problem solved using

properties.setProperty("hibernate.temp.use_jdbc_metadata_defaults", "false");

Thanks all.


Contributing application.yml version of property setting.

spring:  jpa:    properties:      hibernate:        temp:          use_jdbc_metadata_defaults: false