First: this is not a duplicate question.
More than 4.5 years ago another user wrote (on Stackoverflow.com) that he had a requirement where his Spring Boot Application should be able to start even when database is down. He used Spring Boot Application 1 with Hibernate 4. I now have the same problem with Spring Boot Application 2 with Hibernate 5. I tried to apply the checked answer for Hibernate 4, but this doesn't work for my application.
Is it still possible to start it without depending on database? Here are the (edited) Hibernate 5-properties (application.yml
):
spring:
datasource:
url: jdbc:mysql://localhost/schema?serverTimezone=UTC
username: root
password: root
continue-on-error: true
initialization-mode: never
tomcat:
initial-size: 0
time-between-eviction-runs-millis: 5000
min-evictable-idle-time-millis: 5000
min-idle: 0
jpa:
show-sql: true
hibernate:
ddl-auto: none
properties:
hibernate:
dialect: org.hibernate.dialect.MySQL5Dialect
hbm2ddl:
auto: none
temp:
use_jdbc_metadata_defaults: false
My question has been marked as "possible duplicate". The provided possible answer is not a possible answer at all. As I wrote, I am demanded (it is a REQUIREMENT) not to use ANY OTHER DATABASE, EVEN H2. So, the problem is the EntityManagerFactory Bean (together with data source); if it fails to be created, the application fails to start. That's it.