Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot 4.0.0 + GCP : java.lang.NoSuchMethodError: org.springframework.boot.context.config.ConfigDataLocationResolverContext.getBootstrapContext()

I upgraded a Spring Boot application to Spring Boot 4.0.0 with Java 25 LTS, and I am using:

<dependency>
    <groupId>com.google.cloud</groupId>
    <artifactId>spring-cloud-gcp-starter-secretmanager</artifactId>
    <version>7.3.2</version>
</dependency>

When the application starts, it fails with:

java.lang.NoSuchMethodError:
'org.springframework.boot.ConfigurableBootstrapContext
 org.springframework.boot.context.config.ConfigDataLocationResolverContext.getBootstrapContext()'

at com.google.cloud.spring.autoconfigure.secretmanager.SecretManagerConfigDataLocationResolver.registerBean(...)

It looks like Spring Cloud GCP is calling a method that no longer exists in Spring Boot 4.

Is Spring Cloud GCP 7.x compatible with Spring Boot 4.0.0?

like image 511
Henry Xiloj Herrera Avatar asked Sep 01 '26 16:09

Henry Xiloj Herrera


1 Answers

This works with Spring Boot 4.0.3:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.google.cloud</groupId>
            <artifactId>spring-cloud-gcp-dependencies</artifactId>
            <version>8.0.1</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

After aligning the Spring Cloud GCP BOM to 8.0.1, the application runs smoothly.
this my complete notes for migration Spring Boot 3.5.* to Spring Boot 4.0.3

like image 193
Henry Xiloj Herrera Avatar answered Sep 04 '26 06:09

Henry Xiloj Herrera



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!