My springboot microservice depends on AS400 DB2 which may be down when the service starts up. The service has a configuration bean which has autowired JpaRepository based repositories. During startup, when DB2 is down I get following message:
"org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set"
So the services fails to start up and remains dead till forcefully rebooted.
If I set JVM parameter "-Dhibernate.dialect=org.hibernate.dialect.DB2400Dialect", the service starts up and I can make requests to the service when DB2 comes up. It feels like a hack, so I wonder if there is the right way to deal with this issue for springboot services?
I saw this thread, but it doesn't answer my question. Basically what I am looking for is somehow start the microservice with those autowired repositories even if DB is down at the moment so that later, when the actual request comes, the connection to the DB could be restored and request serviced.