javaspringspring-bootspring-cloudnetflix-eureka

Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata


How to fix this error?

Here is it:

Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata

And here is my pom.xml file

<parent>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-parent</artifactId>
   <version>2.5.4</version>
   <relativePath/>
</parent>
<groupId>io.x</groupId>
<artifactId>eureka-server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>eureka-server</name>
<description>Eureka server</description>
<properties>
   <java.version>16</java.version></docker.artifact.version>
   <spring-cloud-starter-eureka-server.version>1.4.7.RELEASE</spring-cloud-starter-eureka-server.version>
</properties>
<dependencies>
   <dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter</artifactId>
   </dependency>

   <dependency>
       <groupId>org.springframework.cloud</groupId>
       <artifactId>spring-cloud-starter</artifactId>
   </dependency>

   <dependency>
       <groupId>org.springframework.cloud</groupId>
       <artifactId>spring-cloud-starter-eureka-server</artifactId>
       <version>${spring-cloud-starter-eureka-server.version}</version>
   </dependency>
</dependencies>
<dependencyManagement>
   <dependencies>
       <dependency>
           <groupId>org.springframework.cloud</groupId>
           <artifactId>spring-cloud-dependencies</artifactId>
           <version>Hoxton.SR12</version>
           <type>pom</type>
           <scope>import</scope>
       </dependency>
   </dependencies>
</dependencyManagement>

Solution

  • You are using Spring Boot 2.5.4 with Spring Cloud Hoxton.SR12.

    As stated in the Spring Cloud compatibility matrix here, Spring Cloud Hoxton.SR12 is compatible with Spring Boot 2.2.x, 2.3.x. So you have to choose the right combination.

    If you want to simplify the version choosing, you can use the Spring Initializr tool.