Very slow Spring Boot application startup

后端 未结 8 1623

I have a simple Spring Boot application that connects to a PostgreSQL database and serves as a JSON service. Somehow the startup has become very slow, see timings 10:37:10 a

8条回答
  •  -上瘾入骨i
    2020-12-23 10:16

    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.

提交回复
热议问题