INFO о нескольких модулях в Spring Boot, что они означают?

Недавно я столкнулся с моей загрузочной версией spring до 1.4.0. Теперь я вижу следующие предупреждения ниже. Я использую spring -mongodb и spring -redis (строго для кеширования). Это что-то, о чем я должен беспокоиться?

Несколько spring Найдены модули данных, введя строгий режим конфигурации репозитория!

Spring Data Redis - Не удалось безопасно определить назначение хранилища для репозитория

Что действительно означает режим строгой настройки хранилища?

    .   ____          _            __ _ _
/\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/  ___)| |_)| | | | | || (_| |  ) ) ) )
'  |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot ::        (v1.4.0.RELEASE)

2016-09-11 00:03:11.234  INFO 24766 --- [           main] testapp.Application                     : Starting Application on macbookhome with PID 24766 (/Users/me/Code/testapp/testapp-svc/build/classes/main started by me in /Users/me/Code/testapp/testapp-svc)
2016-09-11 00:03:11.238  INFO 24766 --- [           main] testapp.Application                     : The following profiles are active: default
2016-09-11 00:03:11.319  INFO 24766 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot[email protected]7393222f: startup date [Sun Sep 11 00:03:11 EDT 2016]; root of context hierarchy
2016-09-11 00:03:14.092  INFO 24766 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2016-09-11 00:03:14.275  INFO 24766 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2016-09-11 00:03:14.346  INFO 24766 --- [           main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface testapp.repositories.topics.TopicRepository.
2016-09-11 00:03:14.349  INFO 24766 --- [           main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface testapp.repositories.entries.EntryRepository.
2016-09-11 00:03:14.350  INFO 24766 --- [           main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface testapp.repositories.AppSettingsRepository.
2016-09-11 00:03:14.351  INFO 24766 --- [           main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface testapp.repositories.UserRepository.
2016-09-11 00:03:14.353  INFO 24766 --- [           main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface testapp.repositories.BookmarkRepository.
2016-09-11 00:03:14.354  INFO 24766 --- [           main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface testapp.repositories.FlagRepository.
2016-09-11 00:03:14.356  INFO 24766 --- [           main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface testapp.repositories.FollowRepository.
2016-09-11 00:03:14.360  INFO 24766 --- [           main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface testapp.repositories.entries.UserEntryRepository.
2016-09-11 00:03:14.361  INFO 24766 --- [           main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface testapp.repositories.ShareRepository.
2016-09-11 00:03:14.899  INFO 24766 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'springAsyncConfiguration' of type [class testapp.configuration.SpringAsyncConfiguration$$EnhancerBySpringCGLIB$$2ae6dc36] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-09-11 00:03:14.923  INFO 24766 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 
2016-09-11 00:03:14.939  INFO 24766 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService  'taskExecutor'
2016-09-11 00:03:14.939  INFO 24766 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'taskExecutor' of type [class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-09-11 00:03:15.026  INFO 24766 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cache.annotation.ProxyCachingConfiguration' of type [class org.springframework.cache.annotation.ProxyCachingConfiguration$$EnhancerBySpringCGLIB$$26a81448] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-09-11 00:03:15.658  INFO 24766 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2016-09-11 00:03:15.674  INFO 24766 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tomcat
2016-09-11 00:03:15.675  INFO 24766 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.4
2016-09-11 00:03:15.801  INFO 24766 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2016-09-11 00:03:15.801  INFO 24766 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 4487 ms
2016-09-11 00:03:16.334  INFO 24766 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'metricFilter' to: [/*]
2016-09-11 00:03:16.335  INFO 24766 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2016-09-11 00:03:16.335  INFO 24766 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2016-09-11 00:03:16.335  INFO 24766 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2016-09-11 00:03:16.336  INFO 24766 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2016-09-11 00:03:16.339  INFO 24766 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2016-09-11 00:03:16.339  INFO 24766 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2016-09-11 00:03:16.340  INFO 24766 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'applicationContextIdFilter' to: [/*]
2016-09-11 00:03:16.341  INFO 24766 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2016-09-11 00:03:17.075  INFO 24766 --- [           main] org.mongodb.driver.cluster               : Cluster created with settings {hosts=[ds041094-a0.mongolab.com:41094, ds041094-a1.mongolab.com:41094], mode=MULTIPLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
2016-09-11 00:03:17.075  INFO 24766 --- [           main] org.mongodb.driver.cluster               : Adding discovered server ds041094-a0.mongolab.com:41094 to client view of cluster
2016-09-11 00:03:17.100  INFO 24766 --- [           main] org.mongodb.driver.cluster               : Adding discovered server ds041094-a1.mongolab.com:41094 to client view of cluster
2016-09-11 00:03:17.863  INFO 24766 --- [golab.com:41094] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:2, serverValue:976946}] to ds041094-a0.mongolab.com:41094
2016-09-11 00:03:17.888  INFO 24766 --- [golab.com:41094] org.mongodb.driver.cluster               : Monitor thread successfully connected to server with description ServerDescription{address=ds041094-a0.mongolab.com:41094, type=REPLICA_SET_PRIMARY, state=CONNECTED, ok=true, version=ServerVersion{versionList=[3, 0, 7]}, minWireVersion=0, maxWireVersion=3, maxDocumentSize=16777216, roundTripTimeNanos=24085956, setName='rs-ds041094', canonicalAddress=ds041094-a0.mongolab.com:41094, hosts=[ds041094-a0.mongolab.com:41094, ds041094-a1.mongolab.com:41094], passives=[], arbiters=[ds041094-ar0.mongolab.com:41094], primary='ds041094-a0.mongolab.com:41094', tagSet=TagSet{[]}, electionId=5736155bb89bc895bfdb9c2f, setVersion=3}
2016-09-11 00:03:17.890  INFO 24766 --- [golab.com:41094] org.mongodb.driver.cluster               : Discovered cluster type of REPLICA_SET
2016-09-11 00:03:17.890  INFO 24766 --- [golab.com:41094] org.mongodb.driver.cluster               : Adding discovered server ds041094-ar0.mongolab.com:41094 to client view of cluster
2016-09-11 00:03:17.891  INFO 24766 --- [golab.com:41094] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:1, serverValue:1178641}] to ds041094-a1.mongolab.com:41094
2016-09-11 00:03:17.892  INFO 24766 --- [golab.com:41094] org.mongodb.driver.cluster               : Setting max election id to 5736155bb89bc895bfdb9c2f from replica set primary ds041094-a0.mongolab.com:41094
2016-09-11 00:03:17.892  INFO 24766 --- [golab.com:41094] org.mongodb.driver.cluster               : Setting max set version to 3 from replica set primary ds041094-a0.mongolab.com:41094
2016-09-11 00:03:17.892  INFO 24766 --- [golab.com:41094] org.mongodb.driver.cluster               : Discovered replica set primary ds041094-a0.mongolab.com:41094
2016-09-11 00:03:17.943  INFO 24766 --- [golab.com:41094] org.mongodb.driver.cluster               : Monitor thread successfully connected to server with description ServerDescription{address=ds041094-a1.mongolab.com:41094, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, version=ServerVersion{versionList=[3, 0, 7]}, minWireVersion=0, maxWireVersion=3, maxDocumentSize=16777216, roundTripTimeNanos=51084368, setName='rs-ds041094', canonicalAddress=ds041094-a1.mongolab.com:41094, hosts=[ds041094-a0.mongolab.com:41094, ds041094-a1.mongolab.com:41094], passives=[], arbiters=[ds041094-ar0.mongolab.com:41094], primary='ds041094-a0.mongolab.com:41094', tagSet=TagSet{[]}, electionId=null, setVersion=3}
2016-09-11 00:03:18.108  INFO 24766 --- [golab.com:41094] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:3, serverValue:2200709}] to ds041094-ar0.mongolab.com:41094
2016-09-11 00:03:18.155  INFO 24766 --- [golab.com:41094] org.mongodb.driver.cluster               : Monitor thread successfully connected to server with description ServerDescription{address=ds041094-ar0.mongolab.com:41094, type=REPLICA_SET_ARBITER, state=CONNECTED, ok=true, version=ServerVersion{versionList=[3, 0, 7]}, minWireVersion=0, maxWireVersion=3, maxDocumentSize=16777216, roundTripTimeNanos=46937906, setName='rs-ds041094', canonicalAddress=ds041094-ar0.mongolab.com:41094, hosts=[ds041094-a0.mongolab.com:41094, ds041094-a1.mongolab.com:41094], passives=[], arbiters=[ds041094-ar0.mongolab.com:41094], primary='ds041094-a0.mongolab.com:41094', tagSet=TagSet{[]}, electionId=null, setVersion=3}
2016-09-11 00:03:18.357  INFO 24766 --- [           main] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:4, serverValue:976947}] to ds041094-a0.mongolab.com:41094
2016-09-11 00:03:20.185  INFO 24766 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: OrRequestMatcher [requestMatchers=[Ant [pattern='/css/**'], Ant [pattern='/js/**'], Ant [pattern='/images/**'], Ant [pattern='/webjars/**'], Ant [pattern='/**/favicon.ico'], Ant [pattern='/error']]], []
2016-09-11 00:03:20.186  INFO 24766 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: Ant [pattern='/health'], []
2016-09-11 00:03:20.186  INFO 24766 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: Ant [pattern='/1.0/users/auth0/userInfo'], []
2016-09-11 00:03:20.186  INFO 24766 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: Ant [pattern='/1.0/users/username/valid'], []
2016-09-11 00:03:20.314  INFO 24766 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: [email protected]1, [org.springframework.secu[email protected]7cd3860, org.spring[email protected]3601549f, [email protected]704, org.[email protected]18f4086e, org.springfram[email protected]228958a, org.sp[email protected]1b9c716f, org.springframework.[email protected]22854f2b, org.springfram[email protected]44f23927, o[email protected]1e6bd367, org[email protected]3205610d, org.springfr[email protected]5b2ff4df]
2016-09-11 00:03:20.323  INFO 24766 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: org.springframework.boot.actuate.autoconfigure.Manage[email protected]253b1cbd, [org.springframework.secu[email protected]a859c5, org.spring[email protected]c335b9, [email protected]fc, org.[email protected]1e66bf2d, org.springfram[email protected]75f2ff80, org.sp[email protected]75c8d8e7, org.springframework.[email protected]3c68e82, org.springfram[email protected]37083af6, o[email protected]671f545b, org[email protected]74a03bd5, org.springfr[email protected]3831f4c2]
2016-09-11 00:03:20.642  INFO 24766 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot[email protected]7393222f: startup date [Sun Sep 11 00:03:11 EDT 2016]; root of context hierarchy
2016-09-11 00:03:20.746  INFO 24766 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/info],methods=[GET],produces=[application/json]}" onto public java.util.HashMap<java.lang.String, java.lang.String> testapp.controllers.AppInfoController.getAppInfo()
2016-09-11 00:03:20.789  INFO 24766 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/1.0/topics/user/{username}],methods=[GET]}" onto public org.springframework.data.domain.Page<testapp.models.Topic> testapp.controllers.api.v1.topic.TopicController.getTopicsByCategory(java.lang.String,java.lang.String,int,int,java.lang.String,java.lang.String,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2016-09-11 00:03:20.791  INFO 24766 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2016-09-11 00:03:20.792  INFO 24766 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2016-09-11 00:03:20.938  INFO 24766 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-09-11 00:03:20.939  INFO 24766 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-09-11 00:03:20.988  INFO 24766 --- [           main] .m.m.a.ExceptionHandlerExceptionResolver : Detected @ExceptionHandler methods in testappSvcExceptionHandler
2016-09-11 00:03:21.046  INFO 24766 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-09-11 00:03:21.755  INFO 24766 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/health || /health.json],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(java.security.Principal)
2016-09-11 00:03:21.759  INFO 24766 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/metrics/{name:.*}],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String)
2016-09-11 00:03:21.759  INFO 24766 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/metrics || /metrics.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-09-11 00:03:22.047  INFO 24766 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2016-09-11 00:03:22.061  INFO 24766 --- [           main] o.s.c.support.DefaultLifecycleProcessor  : Starting beans in phase 0
2016-09-11 00:03:22.193  INFO 24766 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2016-09-11 00:03:22.234  INFO 24766 --- [           main] testapp.Application                     : Started Application in 11.601 seconds (JVM running for 12.241)
2016-09-11 00:06:17.685  INFO 24766 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring FrameworkServlet 'dispatcherServlet'
2016-09-11 00:06:17.685  INFO 24766 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started
2016-09-11 00:06:17.719  INFO 24766 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 34 ms

Ответ 1

Если вы используете redis, реализующий свой собственный уровень персистентности, вы не используете интерфейс, расширяющий CrudRepository.

Это был мой случай, я просто деактивировал поиск в репозиториях redis, и сообщение ниже исчезло из моих репозиториев JPA.

Spring Data Redis - не удалось безопасно определить назначение хранилища для интерфейса-кандидата в хранилище

Чтобы отключить репозитории redis, для которых установлено значение false в application.properties:

spring.data.redis.repositories.enabled = false

Это уже облегчение, потому что для многих репозиториев JPA это довольно раздражает.

Ответ 2

В документах есть целый раздел:

http://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.multiple-modules

В принципе, если вы используете общие интерфейсы (например, CrudRepository), то Spring не будет знать, хотите ли вы, чтобы этот репозиторий был скопирован в модули данных spring -mongodb или spring -redis.

Ответ 3

В моем случае аннотация @Document отсутствовала.

Я использовал несколько модулей Spring Data, то есть Spring Data Mongo и Spring Data Redis.

Ответ 4

В моем случае я правильно использовал все аннотации, но все равно получил ту же ошибку.

Я решил, переместив репозитории JPA и Mongo в разные пакеты и настроив базовые пакеты для каждой из технологий.

@EnableJpaRepositories(basePackages = "com.example.repositories.jpa")
@EnableMongoRepositories(basePackages = "com.example.repositories.mongo")
class ConfigurationClass { ... }