Skip to content

MongoJobRepositoryFactoryBean requirement for MapKeyDotReplacement should be enforced #5346

Open

Description

@snicoll

The Javadoc of MongoJobRepositoryFactoryBean provides all the need that you need

* template and a mongo transaction manager. <strong>The mongo template must be configured
* with a {@link MappingMongoConverter} having a {@code MapKeyDotReplacement} set to a non
* null value. See {@code MongoDBJobRepositoryIntegrationTests} for an example. This is
* required to support execution context keys containing dots (like "step.type" or
* "batch.version")</strong>

However, this concretely makes you create a MongoTemplate for the purpose of Spring Batch as such requirement is unusual.

I am not an expert but asked @mp911de and he's suggesting to:

not use dots in field/property names and instead do the translation differently, by e.g. creating a subdocument after a property terminates at a dot.

If that's not practical, I'd suggest to deprecate protected MongoOperations getMongoOperations() and create one using MongoDatabaseFactory (that should be provided as a new getter).

Activity

  1. nikitanagar08 commented on Mar 19, 2026

    @nikitanagar08

    I would like to work on this issue. Based on the discussion, I understand this involves either:

    1. Not using dots in field/property names and using subdocuments instead, OR
    2. Deprecating getMongoOperations() and creating MongoTemplate using MongoDatabaseFactory

    Let me investigate the codebase and propose a solution.

  2. added 3 commits that reference this issue on Mar 20, 2026
    c19ea1d
    3516d11
    0e1b887
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions