标签:change hang cal inf ble mem path access int
We need our data persistence with configuring our datasouce:
In application.properties:
spring.h2.console.enabled=true spring.h2.console.path=/h2 spring.datasource.url=jdbc:h2:file:~/gs-spring-boot spring.datasource.username=sa spring.datasource.password= spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.max-active=10
spring.datasource.max-idl=8
spring.datasource.max-wait=10000
spring.datasource.min-evictable-idle-time-millis=1000
spring.datasource.min-idle=8
spring.datasource.time-between-eviction-runs-millis=1
"
spring.datasource.url=jdbc:h2:file:~/gs-spring-boot
" tells to save the in memory data into a file called ‘gs-spring-boot‘, you can name the file whatever you want.
Rebuild the application, login h2:
Make sure you change the JDBC URL. Now everytime you restart the server, data won‘t lost
[Spring boot] Configuring and Accessing a Data Source
标签:change hang cal inf ble mem path access int
原文地址:https://www.cnblogs.com/Answer1215/p/10269283.html