[Spring boot] Configuring and Accessing a Data Source
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的更多相关文章
- Spring Boot文档阅读
原因之初 最初习惯百度各种博客教程,然后跟着操作,因为觉得跟着别人走过的路走可以少走很多弯路,省时间.然而,很多博客的内容并不够完整,甚至错误,看多了的博客甚至有千篇一律的感觉.此外,博客毕竟是记载博 ...
- Spring Boot Reference Guide
Spring Boot Reference Guide Authors Phillip Webb, Dave Syer, Josh Long, Stéphane Nicoll, Rob Winch, ...
- 第一个Spring Boot Web程序
需要的环境和工具: 1.Eclipse2.Java环境(JDK 1.7或以上版本)3.Maven 3.0+(Eclipse已经内置了) 写个Hello Spring: 1.新建一个Maven项目,项目 ...
- Spring boot配置文件 application.properties
http://www.tuicool.com/articles/veUjQba 本文记录Spring Boot application.propertis配置文件的相关通用属性 # ========= ...
- spring boot项目配置文件集合
表 1. Spring Boot 推荐的基础 POM 文件 名称 说明 spring-boot-starter 核心 POM,包含自动配置支持.日志库和对 YAML 配置文件的支持. spring-b ...
- spring boot application properties配置详解
# =================================================================== # COMMON SPRING BOOT PROPERTIE ...
- Spring boot 通用配置文件模板
# =================================================================== # COMMON SPRING BOOT PROPERTIE ...
- spring boot配置文件application.propertis
转自http://www.qiyadeng.com/post/spring-boot-application-properties 本文记录Spring Boot application.proper ...
- Spring boot-(2) Spring Boot使用
1. 构建系统 (1) 使用maven构建 1) 从Starter Parent继承 在项目中配置继承spring-boot-starter-parent,可以进行如下设置: <!-- Inhe ...
随机推荐
- 【 HAProxy 】学习笔记
一.haproxy的功能: HAProxy vs LVS HAProxy支持tcp和http两种代理模式,而lvs仅支持tcp代理模式 HAProxy相比LVS的使用要简单 ...
- 【SQL】索引
1.定义 索引:一种数据结构,典型的是B-树,有键值对,键对应属性的某个值,值对应该键的存放位置. 建立索引的目的:加快查询速度 比如: SELECT * FROM Movies ; 如果有studi ...
- ttk.Treeview
TTK的目的. TreeView控件的呈现层次结构,用户可以使用鼠标动作来显示或隐藏结构的任何部分. 与术语“树”的关联是由于编程实践:树结构是一个常见的程序设计.严格地说,在一个TreeView控件 ...
- eclipse出现build path 错误
右击本项目-build path-config build path-libraries-发现有选项是带错误符号,于是点击edit然后点击alternative jre选择安装了的jre就解决问题了
- POJ 2492 A Bug's Life【并查集高级应用+类似食物链】
Background Professor Hopper is researching the sexual behavior of a rare species of bugs. He assumes ...
- 对mysql数据库表的相关操作
虫师博客(Python使用MySQL数据库(新)): https://www.cnblogs.com/fnng/p/3565912.html 1.更改表的结构,增加一个字段放置新增的属性 alter ...
- [Codeforces 15E] Triangle
Brief Introduction: 求从N出发,回到N且不包含任何黑色三角的路径数 Algorithm:假设从N点到第二层中间的节点M的路径数为k,易知总路径数为(k*k+1)*2 而从第第四层开 ...
- 【二分答案】bzoj1639 [Usaco2007 Mar]Monthly Expense 月度开支
#include<cstdio> using namespace std; #define N 100001 int n,m,a[N]; bool check(int x) { int n ...
- 1.8(学习笔记)监听器(Listener)
一.监听器简介 监听器是web容器对某一些对象的监听,当某些对象发生创建.修改.删除的动作时, web容器会自动调用对应的监听器中的方法. 例如A是监听器,B是被监听对象,A的监听任务是B回家时来开门 ...
- 3.4常用类(java学习笔记)Math和Random
一.Math 这个类包含执行指数.对数.平方根法.三角函数等基本的数字运算. Math中还包含一些静态常量供我们调用. 如PI圆周率,E. 1.abs(),返回该数的绝对值. public class ...