gpt4 book ai didi

java - LocalContainerEntityManagerFactoryBean.setPersistenceUnitRootLocation 已在 Spring-Boot 1.4.1 中删除

转载 作者:行者123 更新时间:2023-11-30 07:05:22 25 4
gpt4 key购买 nike

我正在尝试让 SpringBoot 应用程序与 Hibernate 5 一起运行,以利用我认为它包含的 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'

在正确加载依赖项(IDE 缓存等)方面遇到一些不幸的问题后,当我运行 SpringBoot 应用程序时,出现以下错误:

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]

我怀疑某些库未正确更新,或者我的依赖项中缺少某些内容。

最佳答案

你的依赖关系看起来很好。在 IDE 中构建项目后,请检查“spring-orm-4.3.3.RELEASE.jar”是否可用。尝试清理您的 Maven 存储库并重建项目。如果您使用 Eclipse,则可以使用 Maven > 更新项目选项。

关于java - LocalContainerEntityManagerFactoryBean.setPersistenceUnitRootLocation 已在 Spring-Boot 1.4.1 中删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40236737/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com