spring boot + jpa报错:No CurrentSessionContext configured

解决办法
1.核心配置文件中要配置方言

spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect

2.之后添加

spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext

附上本人完整配置文件:

# server
server.port=8081
server.context-path=/

# logs
logging.path=/var/log/demo-activiti-0108-v2-log

# root level
logging.level.root=INFO

# package level
logging.level.com.activiti=DEBUG

# datasource
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/admineap_init
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=root
spring.jpa.hibernate.ddl-auto=none

# activiti default configuration
spring.activiti.check-process-definitions = false

spring.activiti.db-identity-used=false

##thymeleaf
spring.thymeleaf.mode=LEGACYHTML5
spring.thymeleaf.cache=false

spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect
spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext
发布了58 篇原创文章 · 获赞 1 · 访问量 2176

猜你喜欢

转载自blog.csdn.net/qq_37769323/article/details/104054581
今日推荐