Skip to content

Build of OCI image fails with both AOT and CDS when Flyway used #41348

@nwholloway

Description

@nwholloway

Tested with Spring Boot 3.3.1

I was investigating creating an OCI image of a Spring Boot application using both AOT and CDS to create a container with reduced start up time with a JVM, without the additional complexity of building a native image.

This was fine with a do-nothing application using Spring Web, but it fails when you have Flyway as a dependency.

The training run to build the CDS archive does not honour the disabling of Flyway migration (presumably due to being built into the AOT generated classes), so you get the following build error:

[creator]     org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer': Unable to obtain connection from database: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
[creator]     --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[creator]     SQL State  : 08001
[creator]     Error Code : 0
[creator]     Message    : Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

It would be good to have the dual benefits of AOT processing and CDS training when building an OCI image.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: declinedA suggestion or change that we don't feel we should currently applytype: documentationA documentation update

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions