How to insert data to table on spring boot application start?
问题 How can I insert data to a table on Spring Boot application start? My application is generated by JHipster . What I need to check is that if that particular data already exist in that table or not. If it doesn't I should add it. 回答1: You can implement an ApplicationRunner and use a repository to do whatever you need to do. If the ApplicationRunner is a spring bean it is run on application startup. For more sophisticated requirements I would try to rely on a tool like flyway that has good