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. OleDbDataAdapter具体使用11

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  2. Python Standard Library

    Python Standard Library "We'd like to pretend that 'Fredrik' is a role, but even hundreds of vo ...

  3. 用LoopBack搭建RESTful 风格的API

    1.安装node.NPM 2.安装strongloop npm install -g --unsafe-perm install strongloop 3.创建工作目录并且配置loopback应用 m ...

  4. Visual Studio Code更改语言

    参数地址:Visual Studio Code 设置Display Language介绍 在Visual Studio Code中使用快捷键Ctrl + Shift + P可以打开命令行 在local ...

  5. django实现动态菜单的方式

    1.model from django.contrib.auth.models import User #django自带 class UserProfile(models.Model): " ...

  6. flutter 极光推送

    一.配置极光开发者 1.注册极光开发者 https://www.jiguang.cn/push 2.创建应用 二.创建APP 1.添加依赖 pubspec.yaml  添加: flutter_jpus ...

  7. (1)Maven安装及配置

    一.下载 http://maven.apache.org/download.cgi 解压 二.配置环境变量  1 2.path mvn -version 三.本地仓库 本地仓库用来存放远程下载的包,默 ...

  8. E - A strange lift 【数值型BFS+上下方向】

    There is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 ...

  9. Linux命令之umount

    umount [-hV] umount -a [-dflnrv] [-t vfstype] [-O option] umount [-dflnrv] {dir|device} [-t vfstype] ...

  10. 19、Django实战第19天:课程列表页

    从今天开始,我们将完成"公开课"课程的相关功能..... 1.把course-list.html复制到templates目录下 2.这个页面的头部.底部与之前定义的base.htm ...