Run

java -jar -Dspring.profiles.active=dev sport.web.services.jar

Maven

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
</parent>

SessionFactory

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.orm.jpa.vendor.HibernateJpaSessionFactoryBean; @Configuration
public class JpaSessionConfig { @Bean
public HibernateJpaSessionFactoryBean sessionFactory() {
HibernateJpaSessionFactoryBean sessionFactory=new HibernateJpaSessionFactoryBean();
return sessionFactory;
}
}

bootstrap.yml

spring:
application:
name: sport_native_service
profiles:
active: dev

application-dev.yml

spring:
jpa:
database: MYSQL
# 是否显示HQL
show-sql: false
hibernate:
# Entity与数据库表名对应
naming.physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
properties:
javax:
persistence:
sharedCache:
mode: ENABLE_SELECTIVE
hibernate:
# 数据库方言
dialect: org.hibernate.dialect.MySQL5Dialect
# 是否显示统计信息
generate_statistics: flase
# Hibernate二级缓存和Query缓存
cache:
# 二级缓存
use_second_level_cache: true
# Query 缓存
use_query_cache: true
region:
# 使用Ehcache
factory_class: org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory
# Spring Boot 整合Hibernate
current_session_context_class: org.springframework.orm.hibernate5.SpringSessionContext
# 批处理
jdbc.batch_size: 50
messages:
basename: locale/messages
cache-seconds: 3600
eureka:
instance:
hostname: localhost
client:
registerWithEureka: false
fetchRegistry: false
serviceUrl:
defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
app:
cache:
redis:
host: ham.leadadvancetech.com
port: 6379
limit-validation:
cache:
expire: 7200
# 数据源
datasource:
master:
url: jdbc:mysql://ham.leadadvancetech.com:3306/db_theonex?autoReconnect=true&useSSL=false
username: java
password: theonex666
driverClassName: com.mysql.jdbc.Driver
testWhileIdle: true
validationQuery: SELECT 1

Spring Boot 整合 Hibernate5的更多相关文章

  1. Spring Boot 整合 Elasticsearch,实现 function score query 权重分查询

    摘要: 原创出处 www.bysocket.com 「泥瓦匠BYSocket 」欢迎转载,保留摘要,谢谢! 『 预见未来最好的方式就是亲手创造未来 – <史蒂夫·乔布斯传> 』 运行环境: ...

  2. spring boot整合jsp的那些坑(spring boot 学习笔记之三)

    Spring Boot 整合 Jsp 步骤: 1.新建一个spring boot项目 2.修改pom文件 <dependency>            <groupId>or ...

  3. spring boot 系列之四:spring boot 整合JPA

    上一篇我们讲了spring boot 整合JdbcTemplate来进行数据的持久化, 这篇我们来说下怎么通过spring boot 整合JPA来实现数据的持久化. 一.代码实现 修改pom,引入依赖 ...

  4. Spring Kafka和Spring Boot整合实现消息发送与消费简单案例

    本文主要分享下Spring Boot和Spring Kafka如何配置整合,实现发送和接收来自Spring Kafka的消息. 先前我已经分享了Kafka的基本介绍与集群环境搭建方法.关于Kafka的 ...

  5. Spring Boot整合Mybatis并完成CRUD操作

    MyBatis 是一款优秀的持久层框架,被各大互联网公司使用,本文使用Spring Boot整合Mybatis,并完成CRUD操作. 为什么要使用Mybatis?我们需要掌握Mybatis吗? 说的官 ...

  6. spring boot整合Hadoop

    最近需要用spring boot + mybatis整合hadoop,其中也有碰到一些坑,记录下来方便后面的人少走些弯路. 背景呢是因为需要在 web 中上传文件到 hdfs ,所以需要在spring ...

  7. Spring Boot整合Elasticsearch

    Spring Boot整合Elasticsearch   Elasticsearch是一个全文搜索引擎,专门用于处理大型数据集.根据描述,自然而然使用它来存储和搜索应用程序日志.与Logstash和K ...

  8. spring boot 整合 百度ueditor富文本

    百度的富文本没有提供Java版本的,只给提供了jsp版本,但是呢spring boot 如果是使用内置tomcat启动的话整合jsp是非常困难得,今天小编给大家带来spring boot整合百度富文本 ...

  9. spring boot 整合quartz ,job不能注入的问题

    在使用spring boot 整合quartz的时候,新建定时任务类,实现job接口,在使用@AutoWire或者@Resource时,运行时出现nullpointException的问题.显然是相关 ...

随机推荐

  1. 人物-IT-任正非:任正非

    ylbtech-人物-IT-任正非:任正非 任正非,祖籍浙江省浦江县,1944年10月25日出生于贵州省安顺市镇宁县.华为技术有限公司主要创始人兼总裁. 1963年就读于重庆建筑工程学院(现已并入重庆 ...

  2. Code:template

    ylbtech-Code: 1.返回顶部   2.返回顶部   3.返回顶部   4.返回顶部   5.返回顶部     6.返回顶部   作者:ylbtech出处:http://ylbtech.cn ...

  3. ES6学习之Class

    一.定义类(ES6的类,完全可以看做是构造函数的另一种写法) class Greet { constructor(x, y) { this.x = x; this.y = y; } sayHello( ...

  4. DNS服务器的配置与管理

    安装DNS服务器: 在"服务器管理器"-"角色"-"添加角色"中安装DNS服务器. 选择DNS服务器 点下一步安装,然后安装 固定服务器IP ...

  5. Arcane Numbers 1

    Vance and Shackler like playing games. One day, they are playing a game called "arcane numbers& ...

  6. NIPT需要多大的数据量(reads number)?

    NIPT需要多大的数据量(reads number)? 调研 2014 Noninvasive prenatal diagnosis of common aneuploidies by semicon ...

  7. 八数码 Java实现

    参考http://blog.csdn.net/helloworld10086/article/details/41853389 package com.EightNumber.view; import ...

  8. Win10不能直接拖文件/Foxmail不能拖文件解决办法

    在桌面新建一个文本文档   打开文本文档复制下面的文字然后保存. Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\M ...

  9. C#文件监控工具(对追加内容的监控并输出)

    C#文件监控(对追加内容的监控并输出),适合监控某个目录下的日志文件(log),开发初衷是linux上部署在jexus部署网站后想实时输出jexus的log和自己站点的log文件(已经测试通过在mon ...

  10. unity3d AssetStore 下载的资源位置

    Win7,8和Win10系统下: 进入C:\Users\“用户名”目录,然后打开文件夹选项的显示隐藏文件选项 再进入AppData\Roaming\Unity/Asset Store-5.x下找到 M ...