• spring-boot-starter-data-redis 引发的一系列惨案


    1. <dependency>
    2. <groupId>org.springframework.boot</groupId>
    3. <artifactId>spring-boot-starter-data-redis</artifactId>
    4. </dependency>

    pom 引入jar包 ,如果redis配置文件使用 lettuce ,还需要引入 commons-pool2 ,否则会报错

    1. <dependency>
    2. <groupId>org.apache.commons</groupId>
    3. <artifactId>commons-pool2</artifactId>
    4. </dependency>

    还用到了redis分布式锁,引入

    1. <dependency>
    2. <!-- spring integration -->
    3. <groupId>org.springframework.boot</groupId>
    4. <artifactId>spring-boot-starter-integration</artifactId>
    5. <version>2.5.0</version>
    6. </dependency>
    7. <dependency>
    8. <!-- spring integration与redis结合,实现redis分布式锁 -->
    9. <groupId>org.springframework.integration</groupId>
    10. <artifactId>spring-integration-redis</artifactId>
    11. </dependency>

    启动项目时,启动失败

    有一条info信息

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

    但是具体的错误信息是,有个 对象依赖关系无法解析的错误

    开始怀疑是info信息里面的报错影响的

    加了配置

    1. spring:
    2. data:
    3. redis:
    4. repositories:
    5. enabled: false

    没用,再springboot启动类上加入

    @SpringBootApplication(exclude = {RedisRepositoriesAutoConfiguration.class})

    还是报一样的错误

    搜索 RepositoryFactorySupport,的实现 

    JpaRepositoryFactory,R2dbcRepositoryFactory,ReactiveRepositoryFactorySupport

    是项目原有的,引入redis后出现 KeyValueRepositoryFactory,RedisRepositoryFactory

    发现没法排除KeyValueRepositoryFactory ,暂时放弃这个info信息

    解决对象依赖关系无法解析

    No qualifying bean of type xxx available

    核对了类的注解配置都没有问题

    1. public interface xxxxx extends ReactiveSortingRepositoryString> {
    2. ....
    3. }

    怀疑应该是r2dbc 和 redis 之间存在冲突 ,ReactiveCrudRepository 是一个通用接口,可以分配给 Redis 和 R2DBC

    最后将继承的repository类换成 R2dbcRepository

    1. public interface xxxxx extends R2dbcRepository<xxxx,String> {
    2. ....
    3. }

    项目启动正常,后来校验了一下,原来的是这个对象里面使用的表已经不存在了。

  • 相关阅读:
    Linux 虚拟机根目录磁盘空间扩容
    瑞吉外卖实战项目全攻略——总结篇
    前端周刊第二十一期
    嵌入式系统开发【深入浅出】 GPIO 类设备的驱动程序
    Leetcode 15:三数之和
    Python数据分析与机器学习41-使用Gensim库构造中文维基百度数据词向量模型
    从零开始学定位 --- 使用kaist数据集进行LIO-SAM建图
    参数校验与国际化:提高代码稳定性和可维护性的重要方法
    linux查看端口占用情况
    Lua表公共操作
  • 原文地址:https://blog.csdn.net/sinat_38314794/article/details/128117426