morphia icon indicating copy to clipboard operation
morphia copied to clipboard

Deprecation Warning for MapperOptions.Builder in Morphia 2.4.4 but as per migration doc it remains undeprecated

Open waqarabbas opened this issue 9 months ago • 0 comments

Hello Morphia Team,

I am currently using Morphia 2.4.4 and encountering deprecation warnings when using MapperOptions.Builder, despite documentation suggesting it was undeprecated as of version 2.4.

Issue Description: When initializing MapperOptions with the builder pattern, a deprecation and removal warning is displayed. **

Warning 'dev.morphia.mapping.MapperOptions.Builder' is deprecated since version 2.4.0 and marked for removal.

Sample Code


public class SomeClass extends DatastoreImpl {

    private static Datastore initDS(final MongoClient moClient, final String db) {
        MapperOptions options = MapperOptions.builder()
                                             .collectionNaming(NamingStrategy.identity())
                                             .build();

        return Morphia.createDatastore(moClient, db)
                      .configure(options);
    }

    public SomeClass(final Morphia morphia, final MongoClient mongoClient, final String dbName) {
        super(initDS(mongoClient, dbName));
    }

    private void ensureAndPopulateIndexes() {
        // Ensure and populate indexes as necessary
    }

    private void initType(Class<T> entityClass) {
        // Initialize entity type
    }
}

**Server Version**: MongoDB v5.30
**Driver Version**: MongoDB driver 4.11
**Morphia Version**: 2.4.4

waqarabbas avatar Mar 07 '25 14:03 waqarabbas