J'ai récemment augmenté ma version de démarrage de printemps à 1.4.0. Maintenant, je vois les avertissements suivants ci-dessous. J'utilise spring-mongodb et spring-redis (strictement pour la mise en cache). Est-ce quelque chose qui devrait m'inquiéter?
Plusieurs modules Spring Data trouvés, entrant en mode de configuration de référentiel strict!
Spring Data Redis - Impossible d'identifier en toute sécurité l'affectation de magasin pour le référentiel
Que signifie vraiment le mode de configuration de référentiel strict?
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: 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.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@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: org.springframework.security.web.util.matcher.AnyRequestMatcher@1, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@7cd3860, org.springframework.security.web.context.SecurityContextPersistenceFilter@3601549f, org.springframework.security.web.header.HeaderWriterFilter@4e789704, org.springframework.security.web.authentication.logout.LogoutFilter@18f4086e, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@228958a, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@1b9c716f, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@22854f2b, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@44f23927, org.springframework.security.web.session.SessionManagementFilter@1e6bd367, org.springframework.security.web.access.ExceptionTranslationFilter@3205610d, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@5b2ff4df]
2016-09-11 00:03:20.323 INFO 24766 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: org.springframework.boot.actuate.autoconfigure.ManagementWebSecurityAutoConfiguration$LazyEndpointPathRequestMatcher@253b1cbd, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@a859c5, org.springframework.security.web.context.SecurityContextPersistenceFilter@c335b9, org.springframework.security.web.header.HeaderWriterFilter@87fc0fc, org.springframework.security.web.authentication.logout.LogoutFilter@1e66bf2d, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@75f2ff80, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@75c8d8e7, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@3c68e82, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@37083af6, org.springframework.security.web.session.SessionManagementFilter@671f545b, org.springframework.security.web.access.ExceptionTranslationFilter@74a03bd5, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@3831f4c2]
2016-09-11 00:03:20.642 INFO 24766 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@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
Si vous utilisez redis implémentant votre propre couche de persistance, vous n'utilisez pas l'interface qui étend CrudRepository.
C'était mon cas, je viens de désactiver la recherche de référentiels redis et le message ci-dessous a disparu de mes référentiels JPA.
Spring Data Redis - Impossible d'identifier en toute sécurité l'attribution de magasin pour l'interface candidate du référentiel
Pour désactiver les référentiels redis définis sur false dans application.properties
:
spring.data.redis.repositories.enabled = false
C'est déjà un soulagement car pour de nombreux référentiels JPA, c'est assez ennuyeux.
Il y a une section entière dans les documents:
http://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.multiple-modules
Fondamentalement, si vous utilisez les interfaces génériques (par exemple CrudRepository), Spring ne saura pas si vous souhaitez que ce référentiel soit sauvegardé sur les modules de données spring-mongodb ou spring-redis.
Dans mon cas @Document
l'annotation était manquante.
J'ai utilisé plusieurs modules de Spring Data, c'est-à-dire Spring Data Mongo et Spring Data Redis.
Dans mon cas, j'utilisais correctement toutes les annotations, mais j'ai toujours la même erreur.
J'ai résolu le problème en déplaçant les référentiels JPA et Mongo vers différents packages et en configurant les packages de base pour chacune des technologies.
@EnableJpaRepositories(basePackages = "com.example.repositories.jpa")
@EnableMongoRepositories(basePackages = "com.example.repositories.mongo")
class ConfigurationClass { ... }