Home > Back-end >  Start @ PostConstruct service failure
Start @ PostConstruct service failure

Time:10-05

Problem description:
Using the spring framework, the program needs to call a function when it is started from the mysql query data, and then initializes to the redis, this function is to use the @ PostConstruct annotations;
Problem now is that started, database service is not ready, lead to the failure to connect to the database; Web service startup anomaly,

Want to ask next, connect to the database failed, if he can always try again, and again after the connection is successful startup,

CodePudding user response:

No actual configuration like this; Using SpringBoot framework, when Redis configuration using the @ AutoConfigureAfter (data source related add-in) annotations, specify the Redis in data loading before loading should be able to solve this problem, a detailed configuration need you find on the Internet

CodePudding user response:

To implement the monitoring ApplicationListener should be able to meet you
  • Related