今天尝试在项目中整合redis实现缓存的功能,结果当整合完启动项目时,报了一下的错误:
2020-11-23 18:06:29.286 INFO 8864 --- [ restartedMain] c.f.c.CertificateCollectorApplication : Starting CertificateCollectorApplication using Java 1.8.0_191 on FXR-DESKTOP-54BJKDF with PID 8864 (E:\文档\idea_project\JPA\certificate_collector\target\classes started by test in E:\文档\idea_project\JPA\certificate_collector)
2020-11-23 18:06:29.290 INFO 8864 --- [ restartedMain] c.f.c.CertificateCollectorApplication : The following profiles are active: dev
2020-11-23 18:06:29.355 INFO 8864 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2020-11-23 18:06:29.355 INFO 8864 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2020-11-23 18:06:30.433 INFO 8864 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2020-11-23 18:06:30.434 INFO 8864 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode.
2020-11-23 18:06:30.455 INFO 8864 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 11 ms. Found 0 JPA repository interfaces.
2020-11-23 18:06:30.476 INFO 8864 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2020-11-23 18:06:30.477 INFO 8864 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Redis repositories in DEFAULT mode.
2020-11-23 18:06:30.490 INFO 8864 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 4 ms. Found 0 Redis repository interfaces.
2020-11-23 18:06:31.189 INFO 8864 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 3010 (http)
2020-11-23 18:06:31.200 INFO 8864 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-11-23 18:06:31.200 INFO 8864 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.39]
2020-11-23 18:06:31.325 INFO 8864 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-11-23 18:06:31.325 INFO 8864 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1968 ms
2020-11-23 18:06:31.420 WARN 8864 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cacheManager' defined in class path resource [org/springframework/boot/autoconfigure/cache/RedisCacheConfiguration.class]: Unsatisfied dependency expressed through method 'cacheManager' parameter 4; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'spring.redis-org.springframework.boot.autoconfigure.data.redis.RedisProperties': Could not bind properties to 'RedisProperties' : prefix=spring.redis, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'spring.redis.lettuce' to org.springframework.boot.autoconfigure.data.redis.RedisProperties$Lettuce
2020-11-23 18:06:31.423 INFO 8864 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2020-11-23 18:06:31.445 INFO 8864 --- [ restartedMain] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-11-23 18:06:31.467 ERROR 8864 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to bind properties under 'spring.redis.lettuce' to org.springframework.boot.autoconfigure.data.redis.RedisProperties$Lettuce:
Reason: No converter found capable of converting from type [java.lang.String] to type [org.springframework.boot.autoconfigure.data.redis.RedisProperties$Lettuce]
Action:
Update your application's configuration
Process finished with exit code 0
上网查了半天没有找到解决方法,后来再次仔细查看所报的错误后,发现了这个:
Action:
Update your application's configuration
去查看了自己的yml文件:
发现在redis配置里多写了一个lettuce,将这个删除即可。