Describe the bug
I tested Spring 3.5 -> 4.0.0-M1 version upgardes on two programs. One of them went well and the other didn't. Investigating further on the difference between the two, I noticed one was using the opentelemetry-spring-boot-starter dependancy and the other was not. Commenting out opentelemetry-instrumentation-bom (version 2.18.1) and opentelemetry-spring-boot-starter allowed my second program to run.
Interestingly, I didn't have any issues with maven clean, test, or install. All my test cases ran successfully, it was only when I tried running my program that it failed with the following error:
2025-08-01T14:26:43.327-05:00 ERROR 15881 --- [ main] [ ] o.s.boot.SpringApplication : Application run failed
java.lang.IllegalArgumentException: Could not find class [org.springframework.boot.autoconfigure.web.client.RestClientAutoConfiguration]
at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:353) ~[spring-core-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.core.annotation.TypeMappedAnnotation.adapt(TypeMappedAnnotation.java:451) ~[spring-core-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.core.annotation.TypeMappedAnnotation.getValue(TypeMappedAnnotation.java:384) ~[spring-core-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.core.annotation.TypeMappedAnnotation.asMap(TypeMappedAnnotation.java:273) ~[spring-core-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.core.annotation.AbstractMergedAnnotation.asAnnotationAttributes(AbstractMergedAnnotation.java:191) ~[spring-core-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.context.annotation.AnnotationBeanNameGenerator.determineBeanNameFromAnnotation(AnnotationBeanNameGenerator.java:143) ~[spring-context-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.context.annotation.AnnotationBeanNameGenerator.generateBeanName(AnnotationBeanNameGenerator.java:110) ~[spring-context-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.registerBeanDefinitionForImportedConfigurationClass(ConfigurationClassBeanDefinitionReader.java:164) ~[spring-context-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:144) ~[spring-context-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:123) ~[spring-context-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:454) ~[spring-context-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:306) ~[spring-context-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:349) ~[spring-context-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:118) ~[spring-context-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:782) ~[spring-context-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:600) ~[spring-context-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.boot.web.server.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-web-server-4.0.0-M1.jar:4.0.0-M1]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) ~[spring-boot-4.0.0-M1.jar:4.0.0-M1]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:435) ~[spring-boot-4.0.0-M1.jar:4.0.0-M1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-4.0.0-M1.jar:4.0.0-M1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1344) ~[spring-boot-4.0.0-M1.jar:4.0.0-M1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1333) ~[spring-boot-4.0.0-M1.jar:4.0.0-M1]
at com.example.mcssps.McsSps.main(McsSps.java:10) ~[classes/:na]
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.autoconfigure.web.client.RestClientAutoConfiguration
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:580) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:490) ~[na:na]
at java.base/java.lang.Class.forName0(Native Method) ~[na:na]
at java.base/java.lang.Class.forName(Class.java:543) ~[na:na]
at org.springframework.util.ClassUtils.forName(ClassUtils.java:302) ~[spring-core-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:343) ~[spring-core-7.0.0-M7.jar:7.0.0-M7]
... 22 common frames omitted
Steps to reproduce
Add the following to pom.xml
...
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>4.0.0-M1</version>
<relativePath/>
</parent>
...
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-bom</artifactId>
<version>2.18.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencyManagement>
...
<dependencies>
<!-- OpenTelemetry Spring Boot Starter -->
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-spring-boot-starter</artifactId>
</dependency>
</dependencies>
Expected behavior
Expectation is for RestClientAutoConfiguration to be automatically detected and started up using Spring 4.x
Actual behavior
2025-08-01T14:26:43.327-05:00 ERROR 15881 --- [ main] [ ] o.s.boot.SpringApplication : Application run failed
java.lang.IllegalArgumentException: Could not find class [org.springframework.boot.autoconfigure.web.client.RestClientAutoConfiguration]
at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:353) ~[spring-core-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.core.annotation.TypeMappedAnnotation.adapt(TypeMappedAnnotation.java:451) ~[spring-core-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.core.annotation.TypeMappedAnnotation.getValue(TypeMappedAnnotation.java:384) ~[spring-core-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.core.annotation.TypeMappedAnnotation.asMap(TypeMappedAnnotation.java:273) ~[spring-core-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.core.annotation.AbstractMergedAnnotation.asAnnotationAttributes(AbstractMergedAnnotation.java:191) ~[spring-core-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.context.annotation.AnnotationBeanNameGenerator.determineBeanNameFromAnnotation(AnnotationBeanNameGenerator.java:143) ~[spring-context-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.context.annotation.AnnotationBeanNameGenerator.generateBeanName(AnnotationBeanNameGenerator.java:110) ~[spring-context-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.registerBeanDefinitionForImportedConfigurationClass(ConfigurationClassBeanDefinitionReader.java:164) ~[spring-context-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:144) ~[spring-context-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:123) ~[spring-context-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:454) ~[spring-context-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:306) ~[spring-context-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:349) ~[spring-context-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:118) ~[spring-context-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:782) ~[spring-context-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:600) ~[spring-context-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.boot.web.server.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-web-server-4.0.0-M1.jar:4.0.0-M1]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) ~[spring-boot-4.0.0-M1.jar:4.0.0-M1]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:435) ~[spring-boot-4.0.0-M1.jar:4.0.0-M1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-4.0.0-M1.jar:4.0.0-M1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1344) ~[spring-boot-4.0.0-M1.jar:4.0.0-M1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1333) ~[spring-boot-4.0.0-M1.jar:4.0.0-M1]
at com.example.mcssps.McsSps.main(McsSps.java:10) ~[classes/:na]
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.autoconfigure.web.client.RestClientAutoConfiguration
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:580) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:490) ~[na:na]
at java.base/java.lang.Class.forName0(Native Method) ~[na:na]
at java.base/java.lang.Class.forName(Class.java:543) ~[na:na]
at org.springframework.util.ClassUtils.forName(ClassUtils.java:302) ~[spring-core-7.0.0-M7.jar:7.0.0-M7]
at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:343) ~[spring-core-7.0.0-M7.jar:7.0.0-M7]
... 22 common frames omitted
Javaagent or library instrumentation version
2.18.1
Environment
JDK: Amazon Corretto 24, maven 3.9, Spring Boot 4.0.0-M1
OS: Locally on a MacBook Pro (Apple M1 Pro), deployed to a k8s cluster
Additional context
No response
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Describe the bug
I tested Spring 3.5 -> 4.0.0-M1 version upgardes on two programs. One of them went well and the other didn't. Investigating further on the difference between the two, I noticed one was using the
opentelemetry-spring-boot-starterdependancy and the other was not. Commenting out opentelemetry-instrumentation-bom (version 2.18.1) and opentelemetry-spring-boot-starter allowed my second program to run.Interestingly, I didn't have any issues with maven clean, test, or install. All my test cases ran successfully, it was only when I tried running my program that it failed with the following error:
Steps to reproduce
Add the following to pom.xml
Expected behavior
Expectation is for RestClientAutoConfiguration to be automatically detected and started up using Spring 4.x
Actual behavior
Javaagent or library instrumentation version
2.18.1
Environment
JDK: Amazon Corretto 24, maven 3.9, Spring Boot 4.0.0-M1
OS: Locally on a MacBook Pro (Apple M1 Pro), deployed to a k8s cluster
Additional context
No response
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding
+1orme too, to help us triage it. Learn more here.