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

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.
主站蜘蛛池模板: 禹州市| 益阳市| 武川县| 普陀区| 同心县| 特克斯县| 墨玉县| 巴塘县| 九寨沟县| 葫芦岛市| 贵定县| 穆棱市| 张家界市| 达拉特旗| 阳东县| 陇西县| 浮山县| 铁岭县| 大渡口区| 大石桥市| 临猗县| 龙口市| 高青县| 富民县| 墨竹工卡县| 松江区| 连云港市| 雷州市| 内黄县| 南陵县| 建昌县| 永宁县| 开远市| 儋州市| 胶南市| 云安县| 茶陵县| 宣恩县| 禹州市| 伊通| 贞丰县|