There is a REST application https://github.com/kurnakov92/Budget . There are 4 entities: Income, Expence, IncomeCategory, ExpenceCategory. Categories can be used to transfer to income / expense in the name field.

How can I write a default value list in MongoDB using Spring Boot? Those. so that when you first start the application, the following are recorded in the database:

  • Incomes: (Zryaplata, Pension, Help temporarily Krivorukov programmers)
  • To expenses: (Transportation, Food, Utilities, Entertainment, Sports)

They should be recorded only once at the first launch (it should be possible to delete / edit)

  • I was prompted to use the service and method marked @PostConstruct. In principle, this will solve the problem, but maybe there are other solutions? - Bobrovozka

0