Spring Application Advisor Boot 4.0 Liquibase recipe may cause NoSQL applications to fail at startup
search cancel

Spring Application Advisor Boot 4.0 Liquibase recipe may cause NoSQL applications to fail at startup

book

Article ID: 436781

calendar_today

Updated On:

Products

VMware Tanzu Spring Essentials

Issue/Introduction

When Spring Application Advisor is used to upgrade an application to Spring Boot 4.0, a NoSQL application that uses Liquibase can fail to start after the migration changes are applied. Application Advisor uses OpenRewrite recipes to perform dependency and code changes during upgrades.

In affected cases, the migrated application can fail at startup with an error similar to the following:

 
Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception with message: Failed to determine a suitable driver class
 

This behavior is consistent with Spring Boot’s classpath-driven auto-configuration model, where added dependencies can activate related auto-configuration

Environment

 

  • Tanzu Spring Application Advisor 1.5
  • Application upgrade path includes Spring Boot 4.0 commercial recipes
  • The application uses Liquibase in a NoSQL environment, such as MongoDB
  • The migration applies Spring Boot 4.0 modular starter changes automatically

 

Cause

The Spring Boot 4.0 Liquibase recipe may replace org.liquibase:liquibase-core with org.springframework.boot:spring-boot-starter-liquibase without distinguishing between SQL and NoSQL application types.

For NoSQL applications, this can introduce SQL/JDBC-related dependencies onto the classpath. spring-boot-starter-liquibase pulls in spring-boot-starter-jdbc, which in turn brings in JDBC support and HikariCP. Once those classes are present, Spring Boot may attempt SQL DataSource auto-configuration even though the application is not configured to use a SQL database.

Resolution

For affected NoSQL applications, exclude the JDBC starter that is transitively introduced by spring-boot-starter-liquibase.

Maven

Modify the pom.xml to exclude spring-boot-starter-jdbc from the Liquibase starter:

 
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-liquibase</artifactId>
  <exclusions>
    <exclusion>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-jdbc</artifactId>
      </exclusion>
    </exclusions>
</dependency>
 

Gradle

Modify your build.gradle to exclude the JDBC dependency:

implementation('org.springframework.boot:spring-boot-starter-liquibase') {    exclude group: 'org.springframework.boot', module: 'spring-boot-starter-jdbc'}

 

This removes the SQL-oriented dependency path introduced by the Liquibase starter and prevents SQL DataSource auto-configuration from being triggered solely by JDBC-related classes in a NoSQL application.

Another valid approach is to retain org.liquibase:liquibase-core instead of replacing it with org.springframework.boot:spring-boot-starter-liquibase for NoSQL applications.

A product fix will be introduced in future versions.