java Eclipse Sping Boot -在Hibernate Jpa自动配置和缓存自动配置之间检测到自动配置循环

nzk0hqpo  于 2023-03-11  发布在  Java
关注(0)|答案(1)|浏览(147)

我正在使用注入一些其他项目在我的服务。但在集成他们我面临以下异常:java.lang.IllegalStateException:在组织.springframework. Boot .自动配置.orm.jpa. Hibernate Jpa自动配置和组织.springframework.boot.自动配置.cache.缓存自动配置之间检测到自动配置循环
我在主项目中注入的所有项目都是基于spring-boot 2.1.3构建的
什么可以解决这个问题。请让我知道,如果任何其他信息需要有关这一点。
以下是运行服务时生成的日志:

*

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v0.0.1-SNAPSHOT)

2019-05-23 19:49:08.398  INFO 12596 --- [           main] c.k.r.m.KmartMasterServiceApplication    : Starting KmartMasterServiceApplication on ******* with PID (started by athora0 in C:\Users\******\Documents\Migration Project\ababba)
2019-05-23 19:49:08.402  INFO 12596 --- [           main] c.k.r.m.KmartMasterServiceApplication    : No active profile set, falling back to default profiles: default
2019-05-23 19:49:09.691 ERROR 12596 --- [           main] o.s.boot.SpringApplication               : Application run failed

java.lang.IllegalStateException: AutoConfigure cycle detected between org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration and org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration
    at org.springframework.util.Assert.state(Assert.java:73) ~[spring-core-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.boot.autoconfigure.AutoConfigurationSorter.doSortByAfterAnnotation(AutoConfigurationSorter.java:92) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.autoconfigure.AutoConfigurationSorter.doSortByAfterAnnotation(AutoConfigurationSorter.java:95) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.autoconfigure.AutoConfigurationSorter.sortByAnnotation(AutoConfigurationSorter.java:78) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.autoconfigure.AutoConfigurationSorter.getInPriorityOrder(AutoConfigurationSorter.java:67) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector$AutoConfigurationGroup.sortAutoConfigurations(AutoConfigurationImportSelector.java:461) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector$AutoConfigurationGroup.selectImports(AutoConfigurationImportSelector.java:442) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGrouping.getImports(ConfigurationClassParser.java:881) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.processGroupImports(ConfigurationClassParser.java:804) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorHandler.process(ConfigurationClassParser.java:774) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:185) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:315) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:232) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:705) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [mastersignprevention-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at com.kmart.res.master_service.KmartMasterServiceApplication.main(KmartMasterServiceApplication.java:28) [classes/:na]*
46qrfjad

46qrfjad1#

这可能是由于类路径中Sping Boot 库的版本冲突造成的。
在我的例子中,我的类路径中有Sping Boot 库的版本2.0.2.RELEASE和版本2.0.5.RELEASE。
我发现使用gradle bootRun运行解决了依赖关系(到2.0.5.RELEASE中最“乐观”的依赖关系),并且没有出现这个周期错误。
然而,使用cucumber cli类(cucumber.api.cli.Main)运行时,依赖项没有正确解析,Sping Boot 库的 * 两个 * 版本都出现在我的类路径中-并且发生了循环错误。这是因为另一个依赖项正在拉入版本2.0.2.RELEASE。
这是一个多模块项目,每个模块有一个 build.gradle。为了让cubber cli运行我的应用而不出现循环错误,我必须将Sping Boot starter 2.0.5.RELEASE依赖项添加到我运行的模块的 build.gradle 文件中。以前,此依赖项仅位于根 build.gradle 中。

相关问题