How to Start Spring-Boot App Without Database Dependency
For applications employing Spring-boot, Hibernate4, and MySQL, a situation may arise where the sprint-boot app needs to initialize even with an unavailable database. By default, an exception occurs when attempting to start the app. Upon investigation, it appears this issue stems from the "hibernate.temp.use_jdbc_metadata_defaults" property.
Although setting this property in the "application.yml" of Spring Boot may seem logical, it doesn't reflect at runtime. To resolve this, consider these settings:
application.yml:
spring: datasource: driverClassName: com.mysql.jdbc.Driver url: jdbc:mysql://localhost:3306/schema username: root password: root continueOnError: true initialize: false initialSize: 0 timeBetweenEvictionRunsMillis: 5000 minEvictableIdleTimeMillis: 5000 minIdle: 0 jpa: show-sql: true hibernate: ddl-auto: none naming_strategy: org.hibernate.cfg.DefaultNamingStrategy properties: hibernate: dialect: org.hibernate.dialect.MySQL5Dialect hbm2ddl: auto: none temp: use_jdbc_metadata_defaults: false
The above settings enable the application to:
The above is the detailed content of How to Start a Spring-Boot App Without Database Dependency?. For more information, please follow other related articles on the PHP Chinese website!