Implementation method of spring boot after starting the project

preface

We sometimes do other things (such as importing data scripts) after the web project is started. Let's talk about how to add things to be executed after the program is started in spring boot

The method is as follows:

Create a new class: beforestartup java

InitDB. java

In addition, a variable records whether the system has been initialized. If it has been initialized, it will not be initialized. In this way, the default data can be automatically inserted after starting the system, which is very convenient

For relevant codes, see: https://github.com/tomoya92/pybbs

summary

The above is the whole content of this article. I hope the content of this article has a certain reference value for your study or work. If you have any questions, you can leave a message. Thank you for your support for programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>