解决:Error creating bean with name ‘bootstrapImportSelectorConfiguration‘,版本冲突

说明

今天在写springcloud项目的时候项目启动报错,报错信息如下

2023-05-18 14:44:51.754 ERROR 9252 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bootstrapImportSelectorConfiguration': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationPropertiesBean
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601) ~[spring-beans-5.1.11.RELEASE.jar:5.1.11.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.11.RELEASE.jar:5.1.11.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.11.RELEASE.jar:5.1.11.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.11.RELEASE.jar:5.1.11.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.11.RELEASE.jar:5.1.11.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.11.RELEASE.jar:5.1.11.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:847) ~[spring-beans-5.1.11.RELEASE.jar:5.1.11.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.11.RELEASE.jar:5.1.11.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.11.RELEASE.jar:5.1.11.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) [spring-boot-2.1.10.RELEASE.jar:2.1.10.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) [spring-boot-2.1.10.RELEASE.jar:2.1.10.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) [spring-boot-2.1.10.RELEASE.jar:2.1.10.RELEASE]
	at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) [spring-boot-2.1.10.RELEASE.jar:2.1.10.RELEASE]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:197) [spring-cloud-context-3.0.4.jar:3.0.4]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:114) [spring-cloud-context-3.0.4.jar:3.0.4]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:77) [spring-cloud-context-3.0.4.jar:3.0.4]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) [spring-context-5.1.11.RELEASE.jar:5.1.11.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) [spring-context-5.1.11.RELEASE.jar:5.1.11.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) [spring-context-5.1.11.RELEASE.jar:5.1.11.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127) [spring-context-5.1.11.RELEASE.jar:5.1.11.RELEASE]
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:76) [spring-boot-2.1.10.RELEASE.jar:2.1.10.RELEASE]
	at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:53) [spring-boot-2.1.10.RELEASE.jar:2.1.10.RELEASE]
	at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:342) [spring-boot-2.1.10.RELEASE.jar:2.1.10.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:305) [spring-boot-2.1.10.RELEASE.jar:2.1.10.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.1.10.RELEASE.jar:2.1.10.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204) [spring-boot-2.1.10.RELEASE.jar:2.1.10.RELEASE]
	at com.pug.order.OrderApplication.main(OrderApplication.java:23) [classes/:na]
Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationPropertiesBean
	at org.springframework.cloud.context.properties.ConfigurationPropertiesBeans.postProcessBeforeInitialization(ConfigurationPropertiesBeans.java:76) ~[spring-cloud-context-3.0.4.jar:3.0.4]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:414) ~[spring-beans-5.1.11.RELEASE.jar:5.1.11.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1770) ~[spring-beans-5.1.11.RELEASE.jar:5.1.11.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.1.11.RELEASE.jar:5.1.11.RELEASE]
	... 26 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.ConfigurationPropertiesBean
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_202]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_202]
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) ~[na:1.8.0_202]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_202]
	... 30 common frames omitted

问题原因

SpringBoot与SpringCloud的版本不匹配。

问题解决

上网查询SpringBoot与SpringCloud的对应版本

Finchley.M2Spring Boot >=2.0.0.M3 and <2.0.0.M5
Finchley.M3Spring Boot >=2.0.0.M5 and <=2.0.0.M5
Finchley.M4Spring Boot >=2.0.0.M6 and <=2.0.0.M6
Finchley.M5Spring Boot >=2.0.0.M7 and <=2.0.0.M7
Finchley.M6Spring Boot >=2.0.0.RC1 and <=2.0.0.RC1
Finchley.M7=====>Spring Boot >=2.0.0.RC2 and <=2.0.0.RC2
Finchley.M9=====>Spring Boot >=2.0.0.RELEASE and <=2.0.0.RELEASE
Finchley.RC1=====>Spring Boot >=2.0.1.RELEASE and <2.0.2.RELEASE
Finchley.RC2=====>Spring Boot >=2.0.2.RELEASE and <2.0.3.RELEASE
Finchley.SR4=====>Spring Boot >=2.0.3.RELEASE and <2.0.999.BUILD-SNAPSHOT
Finchley.BUILD-SNAPSHOT=====>Spring Boot >=2.0.999.BUILD-SNAPSHOT and <2.1.0.M3
Greenwich.M1=====>Spring Boot >=2.1.0.M3 and <2.1.0.RELEASE
Greenwich.SR5=====>Spring Boot >=2.1.0.RELEASE and <2.1.14.BUILD-SNAPSHOT
Greenwich.BUILD-SNAPSHOT=====>Spring Boot >=2.1.14.BUILD-SNAPSHOT and <2.2.0.M4
Hoxton.SR3=====>Spring Boot >=2.2.0.M4 and <2.3.0.BUILD-SNAPSHOT
Hoxton.BUILD-SNAPSHOTS=====>pring Boot >=2.3.0.BUILD-SNAPSHOT
Hoxton.SR12=====>Spring Boot >=2.2.0.RELEASE and <2.4.0.M1,
2020.0.4=====>Spring Boot >=2.4.0.M1 and <2.5.8-SNAPSHOT",
2020.0.5-SNAPSHOT=====>Spring Boot >=2.5.8-SNAPSHOT and <2.6.0-M1",
2020.0.6=====>Spring Boot >=2.4.0.M1 and <2.6.0-M1,
2021.0.0-M1=====>Spring Boot >=2.6.0-M1 and <2.6.0-M3,
2021.0.0-M3=====>Spring Boot >=2.6.0-M3 and <2.6.0-RC1,
2021.0.0-RC1=====>Spring Boot >=2.6.0-RC1 and <2.6.1,
2021.0.7=====>Spring Boot >=2.6.1 and <3.0.0-M1,
2022.0.0-M1=====>Spring Boot >=3.0.0-M1 and <3.0.0-M2,
2022.0.0-M2=====>Spring Boot >=3.0.0-M2 and <3.0.0-M3,
2022.0.0-M3=====>Spring Boot >=3.0.0-M3 and <3.0.0-M4,
2022.0.0-M4=====>Spring Boot >=3.0.0-M4 and <3.0.0-M5,
2022.0.0-M5=====>Spring Boot >=3.0.0-M5 and <3.0.0-RC1,
2022.0.0-RC1=====>Spring Boot >=3.0.0-RC1 and <3.0.0-RC2,
2022.0.0-RC2=====>Spring Boot >=3.0.0-RC2 and <3.0.0,

或者访问spring官网进行查看
地址如下:
https://start.spring.io/actuator/info

看看我项目的配置,如下图:
在这里插入图片描述
在这里插入图片描述
我使用的SpringCloud版本是:2020.0.4,应该对应的springboot版本是2.4.0.M1到2.5.7-SNAPSHOT,但是我的项目中使用的是2.1.10.RELEASE所有启动会有问题。

然后我就把SpringBoot的版本改成了2.5.8启动就正常了。
在这里插入图片描述

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
在搭建spring项目时通常需要这些jar包 commons-logging-1.1.3.jar spring-aop-4.0.6.RELEASE.jar spring-beans-4.0.6.RELEASE.jar spring-context-4.0.6.RELEASE.jar spring-core-4.0.6.RELEASE.jar spring-expression-4.0.6.RELEASE.jar 在使用spring额外功能时 1 需要在xml文件中加入命名空间 可以在spring-framework-4.0.6.RELEASE\docs\spring-framework-reference\html 中搜索关键字查找配置 2 加入需要的jar包(依赖包) 由于没有引入 spring-aop-4.0.6.RELEASE.jar 引起的错误 org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/aop] Offending resource: class path resource [beans.xml] at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70) 由于缺少依赖包 aspectjweaver-1.6.12.jar http://search.maven.org/remotecontent?filepath=org/aspectj/aspectjweaver/1.6.12/aspectjweaver-1.6.12.jar org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Around 由于缺少依赖包 aopalliance-1.0.jar org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor
UnsatisfiedDependencyException: Error creating bean with name 'contentAspect'是由于依赖注入的问题导致的错误。具体来说,字段'topicService'在注入时存在不满足依赖的情况,进一步导致了嵌套的UnsatisfiedDependencyException错误。类似的问题也出现在'topServiceImpl'的注入过程中,而这次的不满足依赖是因为字段'userService'中的依赖未被满足。 另一方面,Bean with name 'orderServiceImpl'也出现了问题。它在被注入到其他bean(比如ActivityServiceImpl)时,出现了循环引用的情况。虽然这个bean最终被包装起来了,但是其他使用它的bean并没有使用最终版本bean。这通常是过度匹配类型的结果,可以考虑使用'getBeanNamesForType'来检查和关闭过度初始化标志。 总结起来,UnsatisfiedDependencyException: Error creating bean with name 'contentAspect'和其他类似的错误是由于依赖注入不满足的问题导致的。而Bean with name 'orderServiceImpl'的问题则是由于循环引用和过度匹配类型所导致的。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [解决org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ...](https://blog.csdn.net/m290345792/article/details/124936928)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值