我正在尝试使用Hibernate 5运行SpringBoot应用程序,以利用我认为包含的Java LocalDate更改(而不是使用java.util.Date)。
为了获得更新的Hibernate,我在我的Gradle文件中转移到Spring 1.4.1.RELEASE:
dependencies {
compile("org.springframework.boot:spring-boot-starter-web:1.4.1.RELEASE")
compile("org.springframework.boot:spring-boot-starter-data-jpa:1.4.1.RELEASE")
compile("org.springframework.boot:spring-boot-starter-freemarker':1.4.1.RELEASE")
compile group: 'com.h2database', name: 'h2', version:'1.4.191'
compile group: 'org.apache.commons', name: 'commons-lang3', version:'3.1'
compile group: 'org.sitemesh', name: 'sitemesh', version:'3.0.1'
在运行我的SpringBoot应用程序后,在正确加载依赖项(IDE缓存等)的一些不幸问题后,我收到以下错误:
2016-10-25 10:40:36.798 ERROR 7448 --- [ main] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]: Factory method 'entityManagerFactory' threw exception; nested exception is java.lang.NoSuchMethodError:
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.setPersistenceUnitRootLocation(Ljava/lang/String;)V
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1128) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
我怀疑某个库没有正确更新,或者我在依赖项中缺少某些内容。
答案 0 :(得分:1)
您的依赖项看起来很好。请检查" spring-orm-4.3.3.RELEASE.jar"在IDE中构建项目后可用。尝试清理maven存储库并重建项目。如果您正在使用Eclipse,那么您可以使用Maven>更新项目选项。