Running an empty SpringBoot app with a org.springframework.boot:spring-boot-starter-jersey:2.6.7 causes the following exception. Looks like org.glassfish.jersey.ext:jersey-spring5:jar:2.35 includes org.springframework:spring-context:jar:5.1.5.RELEASE, which is incompatible with SpringBoot 2.6.7. Explicitly adding org.springframework:spring-context:jar:5.3.19 solves the issue for my project.

2022-05-08 10:42:48.198 ERROR 31863 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.springframework.boot.SpringApplication.run(SpringApplication.java:301)

The following method did not exist:

    'void org.springframework.context.ConfigurableApplicationContext.setApplicationStartup(org.springframework.core.metrics.ApplicationStartup)'

The calling method's class, org.springframework.boot.SpringApplication, was loaded from the following location:

    jar:file:/Users/andrus/.m2/repository/org/springframework/boot/spring-boot/2.6.7/spring-boot-2.6.7.jar!/org/springframework/boot/SpringApplication.class

The called method's class, org.springframework.context.ConfigurableApplicationContext, is available from the following locations:

    jar:file:/Users/andrus/.m2/repository/org/springframework/spring-context/5.1.5.RELEASE/spring-context-5.1.5.RELEASE.jar!/org/springframework/context/ConfigurableApplicationContext.class

The called method's class hierarchy was loaded from the following locations:

    org.springframework.context.ConfigurableApplicationContext: file:/Users/andrus/.m2/repository/org/springframework/spring-context/5.1.5.RELEASE/spring-context-5.1.5.RELEASE.jar

Action:
Correct the classpath of your application so that it contains compatible versions of the classes org.springframework.boot.SpringApplication and org.springframework.context.ConfigurableApplicationContext

Process finished with exit code 1

Comment From: wilkinsona

This should not occur if you use Spring Boot's dependency management. If you are using Boot's dependency management and the problem is still occurring, can you please provide a minimal sample that reproduces the problem?

Comment From: andrus

Thanks for the hint. Indeed adding SB BOM fixed the issue.