您的Spring配置不正确。
在
spring-boot-starter-data-jpa已经提供了
hibernate-core依赖。当您使用特定版本声明它时:
compile group: 'org.hibernate', name: 'hibernate-core', version: '4.2.2.Final'
您不必再次声明它,因为您指定的版本可能不同,并且与启动程序提供的版本不兼容。
并且根据您的错误,似乎是这种情况,因为
javax.persistence.PersistenceContext.synchronization()在运行时找不到该方法。
合并bean定义的后处理失败;嵌套的异常是
java.lang.NoSuchMethodError:javax.persistence.PersistenceContext.synchronization()Ljavax/persistence/SynchronizationType;
只需删除
hibernate-core依赖项,它就可以工作。



