问题描述
我认为对于spring boot中的mvc项目的设计,可以稍后添加,简单的redis到项目中。
我已经尝试了几天将 redis 添加到我的项目中,但遇到了困难。
我在我的 pom 中添加了这个:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
我在 main 中添加了这个
@Cacheable
Spring Data Redis - Could not safely identify store assignment for repository candidate interface *. If you want this repository to be a Redis repository,consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred),or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.keyvalueRepository.
然后按照我添加的关于stackoverflow的解释:
#spring.data.redis.repositories.type=none
#spring.data.ldap.repositories.enabled=false
spring.main.allow-bean-deFinition-overriding=true
但我收到了这条消息:
Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to localhost/<unresolved>:6379
是的,它无法连接,但我认为通过添加@Cacheable,一切都会自动配置?!
我显然迷路了,我以为就这么简单!
你有一个好的链接,以便我可以在我的项目上设置 redis?谢谢
非常感谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)