Spring - Multiple Spring Data modules found, entering strict repository configuration mode

ROZZ picture ROZZ · Oct 29, 2017 · Viewed 26.1k times · Source

I am using Spring boot 2 with Spring Data, Spring-Data-Elastisearch and Spring-data-Redis(for http sessions). When i start the app. I'm receiving

2017-10-29 17:38:33.376  INFO 18625 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2017-10-29 17:38:33.451  INFO 18625 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2017-10-29 17:38:33.461  INFO 18625 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2017-10-29 17:38:33.768  INFO 18625 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2017-10-29 17:38:33.783  INFO 18625 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.ecommerce.core.repository.elastic.ProductElasticSearchRepository.
2017-10-29 17:38:33.787  INFO 18625 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.ecommerce.core.repository.jpa.UserRepository.
2017-10-29 17:38:33.790  INFO 18625 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.ecommerce.core.repository.jpa.catalog.CategoryJsonWrapperRepository.
2017-10-29 17:38:33.793  INFO 18625 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.ecommerce.core.repository.jpa.catalog.CategoryRepository.
2017-10-29 17:38:33.794  INFO 18625 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.ecommerce.core.repository.jpa.catalog.ProductRepository.

In my App.java file, i have the following lines (which should avoid the ambiguity)

@EnableJpaRepositories(basePackages = {"com.ecommerce.core.repository.jpa"})
@EnableElasticsearchRepositories(basePackages= {"com.ecommerce.core.repository.elastic"})
@EnableRedisRepositories(basePackages = {"org.springframework.data.redis.connection.jedis"})

Every spring data repository extends specific for his job Interface (mainly JpaRepository and one of ElasticsearchCrudRepository

I read this -https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.multiple-modules.types and as you can see, everything should work without issues.

Answer

Hank picture Hank · Mar 20, 2019

Your configurations are all right. The problem is caused by RedisRepositoriesAutoConfiguration. It registers EnableRedisRepositories repeatedly only with default config, which with empty basePackages.

To solve the problem, you could exclude RedisRepositoriesAutoConfiguration by:

@SpringBootApplication(
        exclude = { RedisRepositoriesAutoConfiguration.class }
)
public class MySpringBootApp {

}