As of Spring Data MongoDB 2.2.x, using @Indexed on a @Document causes the following message to appear in the logs:

WARN 1471 --- [  restartedMain] eactiveMongoPersistentEntityIndexCreator : Automatic index creation will be disabled by default as of Spring Data MongoDB 3.x.
    Please use 'MongoMappingContext#setAutoIndexCreation(boolean)' or override 'MongoConfigurationSupport#autoIndexCreation()' to be explicit.
    However, we recommend setting up indices manually in an application ready block. You may use index derivation there as well.

    > -----------------------------------------------------------------------------------------
    > @EventListener(ApplicationReadyEvent.class)
    > public void initIndicesAfterStartup() {
    >
    >     IndexOperations indexOps = mongoTemplate.indexOps(DomainType.class);
    >
    >     IndexResolver resolver = new MongoPersistentEntityIndexResolver(mongoMappingContext);
    >     resolver.resolveIndexFor(DomainType.class).forEach(indexOps::ensureIndex);
    > }
    > -----------------------------------------------------------------------------------------

More details on that in the reference documentation.

We should create a Spring Boot configuration property to enable/disable this configuration to make the transition easier for developers.

Comment From: rhamedy

@bclozel Is this issue open for contribution?

Comment From: philwebb

@rhamedy The issue isn't assigned or pending any design work but it looks as if @ayudovin might have beaten you to it

Comment From: bclozel

Hey @mp911de @christophstrobl, does this issue sounds right to you? What should the users do ideally? Remove @Indexed annotations from their model classes? If we set that property to true, people will still get that WARN message at startup? How should we ease the transition here?

Comment From: mp911de

Adding a property to control index creation sounds about right. We will disable auto-index creation in one of the next releases. The background is that users don't get much control over the actual index creation time if entity types are discovered during runtime and not known at startup time. Therefore, we decided to deprecate the feature. We introduced a configuration flag autoIndexCreation on MongoMappingContext.

@Indexed is still useful and we also introduced utilities to derive and create indexes in a more controlled manner.

Comment From: mbhave

Thanks @mp911de. I'll close this in favor of PR #16454.

Comment From: israelmatiasl

Then, what is the best solution for that alert? I tried but not working. Please help!

Comment From: snicoll

@israelmatiasl please don't ask questions and in particular on closed issues: as mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements.

Comment From: javaHelper

Could you please guide here: https://stackoverflow.com/questions/60003179/please-use-mongomappingcontextsetautoindexcreationboolean-or-override-mong ?

Comment From: awgtek

@Indexed is still useful and we also introduced utilities to derive and create indexes in a more controlled manner.

If it's deprecated how is it still useful? I'm guessing from a documentation standpoint?