官术网_书友最值得收藏!

How to do it...

Let's change the defaults in order to create an embedded H2 database that will not store data in-memory, but rather use a file to persist the data among application restarts, by performing the following steps:

  1. Open the file named application.properties under the src/main/resources directory from the root of our project and add the following content:
spring.datasource.url = jdbc:h2:~/test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE 
spring.datasource.username = sa 
spring.datasource.password = 
  1. Start the application by executing ./gradlew clean bootRun from the command line
  2. Check your home directory, and you should see the following file in there: test.mv.db
The user home directory is located under /home/<username> on Linux and under /Users/<username> on macOS X.
主站蜘蛛池模板: 磴口县| 东平县| 南通市| 巩义市| 长武县| 玉林市| 阳泉市| 仪征市| 台南市| 鄂尔多斯市| 高尔夫| 兴化市| 清流县| 库车县| 临城县| 阿拉善左旗| 尼玛县| 兴海县| 大同县| 泉州市| 农安县| 抚松县| 瑞丽市| 尖扎县| 东方市| 靖远县| 南皮县| 福海县| 金秀| 剑河县| 壤塘县| 三亚市| 静安区| 门源| 喜德县| 桐庐县| 左云县| 惠安县| 永德县| 盘锦市| 延川县|