Solution For : correct the classpath of your application so that it contains compatible versions of the classes org.springframework.boot.springapplication and org.springframework.context.configurableapplicationcontext

I encountered an error indicating that the classpath of my application needs correction to include compatible versions of the classes org.springframework.boot.SpringApplication and org.springframework.context.ConfigurableApplicationContext.

To resolve this issue, I would:

  1. Check the dependencies in my project's build configuration file (such as pom.xml for Maven or build.gradle for Gradle) to ensure that the correct versions of org.springframework.boot.SpringApplication and org.springframework.context.ConfigurableApplicationContext are specified.
  2. Ensure that there are no conflicting dependencies or versions in my project that might be causing the issue.
  3. Update the version numbers of the Spring Boot dependencies in my project to match the compatible versions of the classes mentioned in the error message.
  4. Rebuild and redeploy my application to see if the error persists.
  5. If the error continues, double-check the classpath settings in my IDE or build tool to ensure that the correct libraries are being included.
  6. If none of the above steps resolve the issue, consider seeking help from the Spring community or support channels for further assistance.

Solved issue , I need to ensure that my classpath contains only one version of these classes. I can use the Navigate | Class action to check if there are multiple versions of these classes existing in my project. If I find duplicates, I should exclude the duplicated library dependency in the Maven pom.xml file.

To address the requirements:

  • Downgrade spring-boot to version 2.4.12 for Zuul support.
  • Upgrade the spring version to 5.3.18 to mitigate the RCE vulnerability.
  • Use spring-cloud-starter-bootstrap version 3.0.1 for compatibility with Spring Context.
  • Remove the spring-context dependency.
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.12</version>
<properties>
   <java.version>11</java.version>
   <log4j2.version>2.16.0</log4j2.version>
   <spring.version>5.3.18</spring.version>
</properties>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    <version>2.4.12</version>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-bootstrap</artifactId>
    <version>3.0.1</version>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-zuul</artifactId>
    <version>2.2.2.RELEASE</version>
</dependency>

You can solve this by downgrading Spring Boot:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-web</artifactId>
  <version>2.3.3.RELEASE</version>
</dependency>