错误信息
java.lang.NoClassDefFoundError:org/springframework/boot/context/properties/ConfigurationPropertiesBean
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.event.internalEventListenerProcessor': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationPropertiesBean
.......
Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationPropertiesBean
at org.springframework.cloud.context.properties.ConfigurationPropertiesBeans.postProcessBeforeInitialization(ConfigurationPropertiesBeans.java:94) ~[spring-cloud-context-2.2.6.RELEASE.jar:2.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:416) ~[spring-beans-5.0.10.RELEASE.jar:5.0.10.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1686) ~[spring-beans-5.0.10.RELEASE.jar:5.0.10.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:573) ~[spring-beans-5.0.10.RELEASE.jar:5.0.10.RELEASE]
... 26 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.ConfigurationPropertiesBean
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_131]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_131]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) ~[na:1.8.0_131]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_131]
... 30 common frames omitted
错误原因
springboot版本和springcloud版本不兼容,导致两者不匹配报错,修改为对应版本即可
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<!-- SpringBoot版本 -->
<version>2.0.6.RELEASE</version>
<relativePath/>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<!-- SpringCloud版本 -->
<spring-cloud.version>Finchley.SR4</spring-cloud.version>
</properties>
版本对应关系:
spring-boot-starter-parent | spring-cloud-dependencie |
---|---|
1.2.x | Angel版本 |
1.3.x | Brixton版本 |
1.4.x | Camden版本 |
1.5.2.RELEASE | Dalston.RC1 |
1.5.2.RELEASE | Dalston.RC1 |
1.5.16/20.RELEASE | Edgware.RELEASE |
2.0.0.M3 ~ 2.0.0.M5 | Finchley.M2 |
2.0.0.M5 | Finchley.M3 |
2.0.0.M6 | Finchley.M4 |
2.0.0.M7 | Finchley.M5 |
2.0.0.RC1 | Finchley.M6 |
2.0.0.RC2 | Finchley.M7 |
2.0.0.RELEASE | Finchley.M9 |
2.0.1.RELEASE ~ 2.0.2.RELEASE | Finchley.RC1 |
2.0.2.RELEASE ~ 2.0.3.RELEASE | Finchley.RC2 |
2.0.3.RELEASE ~ 2.0.999.BUILD-SNAPSHOT | Finchley.SR4 |
2.0.999.BUILD-SNAPSHOT ~ 2.1.0.M3 | Finchley.BUILD-SNAPSHOT |
2.1.0.M3 ~ 2.1.0.RELEASE | Greenwich.M1 |
2.1.0.RELEASE ~ 2.1.16.BUILD-SNAPSHOT | Greenwich.SR6 |
2.1.16.BUILD-SNAPSHOT ~ 2.2.0.M4 | Greenwich.BUILD-SNAPSHOT |
2.3.2.BUILD-SNAPSHOT ~ 2.4.0.M1 | Hoxton.BUILD-SNAPSHOT |
2.4.0.M1~... | 2020.0.0-SNAPSHOT |