Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoPersistentEntityIndexCreator should not warn when auto-index-creation property is set [DATAMONGO-2435] #3247

Closed
spring-projects-issues opened this issue Dec 5, 2019 · 2 comments

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Dec 5, 2019

Jochen Christ opened DATAMONGO-2435 and commented

When starting a fresh Spring Boot 2.2.1 application with Spring Data MongoDB support, then the warning appears, as soon a @Document is created with a @Index.

2019-12-04 18:52:52.161  WARN 94633 --- [           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);
	> }
	> -----------------------------------------------------------------------------------------

As the log suggest, it is now possible to explicitly enable or disable auto index creation with the property:

Example in Spring-Boot:

spring.data.mongodb.auto-index-creation=true

However, the warning still appears.
Should be changed to not show the warning, once the property is set explicitly


Affects: 2.2.3 (Moore SR3)

Reference URL: spring-projects/spring-boot#19236

Issue Links:

0 votes, 5 watchers

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Feb 11, 2020

ArnauAregall commented

CC Andy Wilkinson since the issue on Github was closed without a reference to the JIRA

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Mar 26, 2020

Mark Paluch commented

This logging no longer happens with Spring Data MongoDB 3.0 as automatic index creation is disabled by default and we've removed the log message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants