Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 835 Vote(s) - 3.54 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Spring Boot - Loading Initial Data

#21
You can add a `spring.datasource.data` property to `application.properties` listing the sql files you want to run. Like this:

spring.datasource.data=classpath:accounts.sql, classpath:books.sql, classpath:reviews.sql

//or (depending on SB version)

spring.sql.init.data-locations=classpath:accounts.sql, classpath:books.sql, file:reviews.sql

The sql insert statements in each of these files will then be run, allowing you to keep things tidy.

If you put the files in the classpath, for example in `src/main/resources` they will be applied. Or replace `classpath:` with `file:` and use an absolute path to the file

If you want to run DDL type SQL then use:
```
spring.datasource.schema=classpath:create_account_table.sql

// depending on spring version

spring.sql.init.schema-locations=classpath:create_account_table.sql
```

**Edit:** these solutions are great to get you up and running quickly, however for a more production ready solution it would be worth looking at a framework such as [flyway][1], or [liquibase][2]. These frameworks integrate well with spring, and provide a quick, consistent, version-controlled means of initialising schema, and standing-data.


[1]:

[To see links please register here]

[2]:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through