从昨天开始,我在正在开发的 Spring Boot 应用程序 (1.5.2.RELEASE) 上遇到了一个非常奇怪的错误。在 Eclipse 中运行项目时,我开始遇到以下异常。
从命令行运行它时,一切正常(但在开发和调试时我仍然需要从 Eclipse 运行它)。我试过删除 .classpath 文件 https://github.com/spring-projects/spring-boot/issues/9278,重新导入项目,在Eclipse中清理它们,但错误仍然存在
2017-12-05 13:46:45.620 ERROR 11048 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Destroy method on bean with name 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory' threw an exception
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@744ed1b7: startup date [Tue Dec 05 13:46:43 EET 2017]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:404) [spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
<STACK-TRACE>
2017-12-05 13:46:45.635 ERROR 11048 --- [ restartedMain] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.almetis.webraadmin.WebRaAdminApplication];
nested exception is java.lang.IllegalStateException: AutoConfigure cycle detected between org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration and org.springframework.boot.autoconfigure.data.neo4j.Neo4jDataAutoConfiguration
at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:545) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
<STACK-TRACE>
Caused by: java.lang.IllegalStateException: AutoConfigure cycle detected between org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration and org.springframework.boot.autoconfigure.data.neo4j.Neo4jDataAutoConfiguration
at org.springframework.util.Assert.state(Assert.java:70) ~[spring-core-4.3.7.RELEASE.jar:4.3.7.RELEASE]
升级我的主项目和库以使用 Spring Boot 1.5.8.RELEASE 后,我可以再次在 Eclipse 中运行我的应用程序。
1.5.2.RELEASE 与 Neo4J 的集成似乎有问题(参见 githubissue https://github.com/spring-projects/spring-boot/issues/9278 and issue https://github.com/spring-projects/spring-boot/issues/8587).
仔细观察后,我发现了原因:我的主应用程序使用的是 Spring Boot 1.5.2,它使用的库之一使用的是 Spring Boot 1.5.8。
在尝试了我的库和主应用程序的 Spring Boot 版本之后,我看到:
这个错误有点神秘(至少可以这么说),但主要的收获是将所有库和应用程序保持在同一 Spring Boot 版本上.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)