MBP
MBP copied to clipboard
Investigate strange logs on startup
2021-02-02 16:00:38.979 WARN --- [ main] .m.c.i.MongoPersistentEntityIndexCreator : 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);
> }
> -----------------------------------------------------------------------------------------
There is not much we can do to get rid of this issue. A solution would probably to upgrade Mongo dependencies again: https://jira.spring.io/browse/DATAMONGO-2435
@schneijan ok, I would say we do the update after the first release because we started the testing phase already. Probably we will need a new test phase after the upgrade of mongoDB.