BarboraC
BarboraC

Reputation: 23

How to run GraalVM native image with spring cloud bootstrap enabled?

I have 3.2.2 spring-boot application with spring cloud bootstrap enabled. I'm building GraalVm native image with mvn -Pnative native:compile.

When I run the native image I get:

Web application could not be started as there was no org.springframework.boot.web.reactive.server.ReactiveWebServerFactory bean defined in the context.

If bootstrap isn't enabled the image works. I also tried adding org.springframework.cloud:spring-cloud-starter-bootstrap dependency instead of spring.cloud.bootstrap.enabled system property but with the same result.

Does anyone have a solution to get it working even with org.springframework.cloud:spring-cloud-starter-bootstrap dependency or spring.cloud.bootstrap.enabled property?

UPDATE

Minimal dependencies set to reproduce:

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-webflux</artifactId>
    </dependency>

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

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

Upvotes: 0

Views: 774

Answers (1)

ozkanpakdil
ozkanpakdil

Reputation: 4612

spring-cloud-starter-bootstrap is deprecated and not used in spring boot 3 , you can see it here

Since bootstrap has been deprecated for newer versions of Spring, I think putting it in the application.properties is fine. Check out this StackOverflow (as posted earlier by duydoanx)

Another doc shows bootstrap yml is expired. Instead you can use "spring-cloud-starter" and move all bootstrap yml configuration to application yml or properties files, check this template.

Upvotes: 1

Related Questions