我正在使用在我的服务中注入一些其他项目。但是在集成它们时我面临以下异常:
java.lang.IllegalStateException:在 org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration 和 org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration 之间检测到自动配置循环
我在主项目中注入的所有项目都是基于 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]*
这可能是由于类路径中 Spring Boot 库的版本冲突造成的(请参阅:https://github.com/spring-projects/spring-boot/issues/9278#issuecomment-303077249)
就我而言,我有一个使用 cucumber cli(Cucumber Java 插件)运行的 IntelliJ 项目。 IntelliJ 将 Spring Boot 库的版本 2.0.2.RELEASE 和版本 2.0.5.RELEASE 放入我的类路径中。
如果我使用 gradle bootRun 运行相同的项目,它会正确解决依赖关系,并且仅将 2.0.5.RELEASE 库放在我的类路径上。因此没有发生循环错误。
允许使用 cucumber cli 运行的解决方案是将 Spring Boot starter 2.0.5.RELEASE 依赖项添加到构建.gradle我正在运行的模块的文件(这是一个多模块项目)。这从类路径中删除了 2.0.2.RELEASE 库。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)