项目场景
SpringBoot启动报错,大致报错信息如下:
2021-03-11 12:38:15.512 ERROR 16912 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurationPropertiesBeans' defined in class path resource [org/springframework/cloud/autoconfigure/ConfigurationPropertiesRebinderAutoConfiguration.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
先把项目中主要依赖的版本梳理一遍,这些版本都是这个时间段(2021年3月上旬)的最新版本:
依赖 | 版本 |
---|---|
Spring Boot | 2.4.3 |
Spring Cloud | 2020.0.1 |
com.alibaba.cloud » spring-cloud-starter-alibaba-nacos-discovery | 2.2.5.RELEASE |
com.alibaba.cloud » spring-cloud-starter-alibaba-nacos-config | 2.2.5.RELEASE |
org.springframework.cloud » spring-cloud-starter-loadbalancer | 3.0.1 |
org.elasticsearch.client » elasticsearch-rest-high-level-client | 7.11.1 |
其中nacos discovery
去除了org.springframework.cloud
» spring-cloud-starter-netflix-ribbon
这个依赖,这又是另一个问题:
问题描述
今天在项目的pom.xml
中添加elasticsearch-rest-high-level-client
依赖之后,SpringBoot启动就报错了,引入依赖之前项目启动是正常的,详细报错信息如下:
2021-03-11 12:38:15.512 ERROR 16912 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurationPropertiesBeans' defined in class path resource [org/springframework/cloud/autoconfigure/ConfigurationPropertiesRebinderAutoConfiguration.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:579) ~[spring-beans-5.3.4.jar:5.3.4]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.4.jar:5.3.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.4.jar:5.3.4]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.4.jar:5.3.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.4.jar:5.3.4]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213) ~[spring-beans-5.3.4.jar:5.3.4]
at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:270) ~[spring