Closed mitu2 closed 1 month ago
more complete output.
2024-07-14T20:15:34.567+02:00 INFO 4171 --- [spring-data-example] [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode
2024-07-14T20:15:34.567+02:00 INFO 4171 --- [spring-data-example] [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2024-07-14T20:15:34.618+02:00 INFO 4171 --- [spring-data-example] [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 42 ms. Found 2 JPA repository interfaces.
2024-07-14T20:15:34.620+02:00 INFO 4171 --- [spring-data-example] [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode
2024-07-14T20:15:34.621+02:00 INFO 4171 --- [spring-data-example] [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Elasticsearch repositories in DEFAULT mode.
2024-07-14T20:15:34.629+02:00 INFO 4171 --- [spring-data-example] [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 7 ms. Found 1 Elasticsearch repository interface.
2024-07-14T20:15:34.857+02:00 INFO 4171 --- [spring-data-example] [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode
2024-07-14T20:15:34.858+02:00 INFO 4171 --- [spring-data-example] [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Reactive Elasticsearch repositories in DEFAULT mode.
2024-07-14T20:15:34.875+02:00 INFO 4171 --- [spring-data-example] [ restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Reactive Elasticsearch - Could not safely identify store assignment for repository candidate interface org.example.springdataexample.repositories.jdbc.ItemRepository; If you want this repository to be a Reactive Elasticsearch repository, consider annotating your entities with one of these annotations: org.springframework.data.elasticsearch.annotations.Document (preferred), or consider extending one of the following types with your repository: org.springframework.data.elasticsearch.repository.ReactiveElasticsearchRepository
2024-07-14T20:15:34.876+02:00 INFO 4171 --- [spring-data-example] [ restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Reactive Elasticsearch - Could not safely identify store assignment for repository candidate interface org.example.springdataexample.repositories.jdbc.PersonRepository; If you want this repository to be a Reactive Elasticsearch repository, consider annotating your entities with one of these annotations: org.springframework.data.elasticsearch.annotations.Document (preferred), or consider extending one of the following types with your repository: org.springframework.data.elasticsearch.repository.ReactiveElasticsearchRepository
2024-07-14T20:15:34.876+02:00 INFO 4171 --- [spring-data-example] [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 17 ms. Found 0 Reactive Elasticsearch repository interfaces.
@mp911de can you explain why reactive repositories are searched here?
you can set spring.data.elasticsearch.repositories.enabled=false in config to avoid spring data scan your repositories
The question is not how to disable repository scanning, but why a reactive repository scan is done.
Reactive repositories are enabled by Spring Boot via ReactiveElasticsearchRepositoriesAutoConfiguration
when ReactiveElasticsearchClient
and ReactiveElasticsearchRepository
are on the classpath. Store arrangements where reactive components are part of the actual Spring Data module always provide these foundational types, however, the dependant bits such as Mono
and Flux
aren't on the classpath so ideally, these should be considered in Boot's ReactiveElasticsearchRepositoriesAutoConfiguration
. I suggest reaching out to the Boot team for refining the condition setup.
I mirrored it. https://github.com/spring-projects/spring-boot/issues/41672
problem description
I didn't use
@EnableReactiveElasticsearchRepositories
, But it seems to scan my code and throw out some info messages.I wonder why it works, and it generates a message every time I add a JPA repository.I found that ReactiveElasticsearchRepositoriesAutoConfiguration triggers at the same time as ElasticsearchRepositoriesAutoConfiguration, and now I can only exclude one startup class to avoid it scanning my code with another
Is there a better way to avoid this?
example code
I told you about my example code uploaded to
https://github.com/mitu2/spring-data-example