Spring App Advisor Fails to Update MongoProperties Import During MongoDB Upgrade
search cancel

Spring App Advisor Fails to Update MongoProperties Import During MongoDB Upgrade

book

Article ID: 433921

calendar_today

Updated On:

Products

VMware Tanzu Platform Spring

Issue/Introduction

When using Spring App Advisor to upgrade a Spring application (specifically targeting Spring Boot 4.x), the tool successfully migrates most MongoDB-related configurations and dependencies. For example, it correctly updates application properties (changing spring.data.mongodb.database to spring.mongodb.database) and updates Maven POM coordinates (migrating org.testcontainers.mongodb to org.testcontainers.testcontainers-mongodb).

However, the Advisor fails to update the Java import statement for MongoProperties. After the tool completes the upgrade, developers will experience compilation errors indicating that the legacy MongoProperties class cannot be found.

Environment

  • Tool: Tanzu Spring App Advisor

  • Framework: Spring Boot (Upgrading to 4.x)

  • Components: Spring Data MongoDB, MongoDB Testcontainers

 

Cause

During the Spring Boot 4.x release cycle, several MongoDB auto-configuration classes and properties were restructured into new, modular packages. While Spring App Advisor successfully executes the refactoring recipes to migrate properties (application.yml/application.properties) and build dependencies, the specific automation rule to migrate the MongoProperties package namespace is either missing or failing to trigger. Consequently, the tool leaves the legacy Spring Boot 3.x import path intact within the source code.

Resolution

Until the issue is fixed in a future release, to resolve the resulting compilation errors, you must manually update the import statements in the affected Java classes.

  1. Identify the Java classes failing to compile due to the unresolved MongoProperties import.

  2. Remove the legacy import statement:

    import org.springframework.boot.autoconfigure.mongo.MongoProperties;
    
  3. Replace it with the updated Spring Boot 4.x import:

    import org.springframework.boot.mongodb.autoconfigure.MongoProperties;
    
  4. Rebuild and compile your application to verify the fix.