Skip to content

Add environment variable to skip repository initialization. #2878

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

Merged
merged 1 commit into from
Mar 24, 2024

Conversation

sothawo
Copy link
Collaborator

@sothawo sothawo commented Mar 24, 2024

lazy intialization (which could probably only be done by a method interceptor on the repository proxy) is problematic in the reactive context, so we are not using this approach.

This PR adds the possibility to just skip the initialization of the data in Elasticsearch by setting the environment variable SPRING_DATA_ELASTICSEARCH_SKIP_REPOSITORY_INIT=true.

If an application needs to have the repository initialized when this property is set to true, the createIndexAndMappingIfNeeded() from the Simple(Reactive)ElasticsearchRepository must be explicitly called before writing data with the repository.

Closes #2876

@sothawo sothawo merged commit 7f17823 into spring-projects:main Mar 24, 2024
@sothawo sothawo deleted the #2876-skip-repo-init branch March 25, 2024 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make calls to create index and mapping in repositories (optionally) lazy.
1 participant