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的更多相关文章

  1. Spring Boot文档阅读

    原因之初 最初习惯百度各种博客教程,然后跟着操作,因为觉得跟着别人走过的路走可以少走很多弯路,省时间.然而,很多博客的内容并不够完整,甚至错误,看多了的博客甚至有千篇一律的感觉.此外,博客毕竟是记载博 ...

  2. Spring Boot Reference Guide

    Spring Boot Reference Guide Authors Phillip Webb, Dave Syer, Josh Long, Stéphane Nicoll, Rob Winch,  ...

  3. 第一个Spring Boot Web程序

    需要的环境和工具: 1.Eclipse2.Java环境(JDK 1.7或以上版本)3.Maven 3.0+(Eclipse已经内置了) 写个Hello Spring: 1.新建一个Maven项目,项目 ...

  4. Spring boot配置文件 application.properties

    http://www.tuicool.com/articles/veUjQba 本文记录Spring Boot application.propertis配置文件的相关通用属性 # ========= ...

  5. spring boot项目配置文件集合

    表 1. Spring Boot 推荐的基础 POM 文件 名称 说明 spring-boot-starter 核心 POM,包含自动配置支持.日志库和对 YAML 配置文件的支持. spring-b ...

  6. spring boot application properties配置详解

    # =================================================================== # COMMON SPRING BOOT PROPERTIE ...

  7. Spring boot 通用配置文件模板

    # =================================================================== # COMMON SPRING BOOT PROPERTIE ...

  8. spring boot配置文件application.propertis

    转自http://www.qiyadeng.com/post/spring-boot-application-properties 本文记录Spring Boot application.proper ...

  9. Spring boot-(2) Spring Boot使用

    1. 构建系统 (1) 使用maven构建 1) 从Starter Parent继承 在项目中配置继承spring-boot-starter-parent,可以进行如下设置: <!-- Inhe ...

随机推荐

  1. 【bzoj2561】最小生成树

    嗯……这题是一个网络流. 加入的边为u,v长度L 则所有长度大于L的边不能使得u,v连通 求个最小割即可.小于同理 两次最小割结果相加. #include<bits/stdc++.h> # ...

  2. JS实现上下左右对称的九九乘法表

    JS实现上下左右对称的九九乘法表 css样式 <style> table{ table-layout:fixed; border-collapse:collapse; } td{ padd ...

  3. [ 总结 ] nginx 编译参数中文详解

    贴出来,方便查找和学习. nginx 编译参数: --prefix=PATH    指向安装目录--sbin-path=PATH    指向(执行)程序文件--conf-path=PATH    指向 ...

  4. [ 总结 ] 删除通过find查找到的文件

    [root@cloud abc]# touch test{,,,} [root@cloud abc]# ls shadow test test1 test2 test3 test5 [root@clo ...

  5. 【C语言】++(a++)的写法是错的

    http://bbs.csdn.net/topics/390764053 a++得到的是一个右值,++操作需要的是一个左值. ------------------------------------- ...

  6. 驱动模块和装模块的概念——Junit单元测试案例

    驱动模块是用来模拟被测试模块的上一级模块,相当于被测模块的主程序.它接收数据,将相关数据传送给被测模块,启用被测模块,并打印出相应的结果. 桩模块(Stub)是指模拟被测试的模块所调用的模块,而不是软 ...

  7. 杀掉TOMCAT并重启的脚本

    /usr/local/tomcat7/bin/shutdown.sh sleep #具体时间就看你得webapp在调用shutdown.sh后多久后处于僵死状态 ps -ef | grep sleep ...

  8. Centos7Yum安装PHP7.2

    1.安装源 安装php72w,是需要配置额外的yum源地址的,否则会报错不能找到相关软件包. php高版本的yum源地址,有两部分,其中一部分是epel-release,另外一部分来自webtatic ...

  9. XAMPP配置vhosts多站点/绝对正确

    XAMPP有时候你需要一些顶级域名访问方式来访问你本地的项目也就是虚拟主机配置,这时候就需要配置虚拟主机,给你的目录绑定一个域名,实现多域名绑定访问. 在Mac 下一直使用 MAMP 搭建本地 php ...

  10. 小型Web应用扫描工具Grabber

    小型Web应用扫描工具Grabber   Grabber是Kali Linux集成的一款Web应用扫描工具.该工具适合中小Web应用,如个人博客.论坛等.该工具使用Python语言编写,支持常见的漏洞 ...