文章目录
- Spring Cloud常见问题
- ruoyi-cloud版本
- 1. RuoYiSystemApplication启动失败,数据库连接失败
- 2.nacos 客户端无法连接
- 3.启动时候Invalid bound statement (not found):*.*.mapper.SysConfigMapper.selectConfigList 报错
- 4.集成MPP后@TEST类运行报错:Error creating bean with name 'com.ruoyi.test.RuoyiTestApplicationTests': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.ruoyi.test.mapper.ITestEntityMapper' available: expected at least 1 bean which qualifies as autowire candidate.
Spring Cloud常见问题
ruoyi-cloud版本
*初次使用请一定要参考博客码云项目RuoYi-Cloud启动跳坑指南
1. RuoYiSystemApplication启动失败,数据库连接失败

- 原因:无法通过ry-config中
ruoyi-system-dev.yml获取正确的jdbc连接 - 解决方案:检查默认的配置中是否和当前物理机的数据库情况一致,可能本地的数据库账号密码和ruoyi-config中默认的不一致,修改一致后重启即可。我的情况是ry-config在云数据库中,所以需要修改成云数据库的地址和密码。方式如下:

2.nacos 客户端无法连接
确保nacos client >=nacos server的版本即可
3.启动时候Invalid bound statement (not found):..mapper.SysConfigMapper.selectConfigList 报错
- 原因:有可能是配置文件未加载到导致或者bean注入失败。其实是nacos-server并未读取到配置
- 解决方法:不使用nacos的内置数据库,而是连接到ruoyi-config所在的数据库,加载到相应的配置即可。正确加载的nacos-dashboard页面如下:

4.集成MPP后@TEST类运行报错:Error creating bean with name ‘com.ruoyi.test.RuoyiTestApplicationTests’: Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.ruoyi.test.mapper.ITestEntityMapper’ available: expected at least 1 bean which qualifies as autowire candidate.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘com.ruoyi.test.RuoyiTestApplicationTests’: Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.ruoyi.test.mapper.ITestEntityMapper’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessProperties(CommonAnnotationBeanPostProcessor.java:332)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)
- 原因:IxxMapper注入失败,调用时找不到
- 解决办法:启动类扫描这些包并进行注入。启动类加入注解
@MapperScan(basePackages = "com.ruoyi.test.mapper")

本文档汇总了RuoYi-Cloud在使用SpringCloud过程中遇到的问题及其解决方案,包括RuoYiSystemApplication启动失败、nacos客户端连接问题、SysConfigMapper报错以及测试类运行报错。针对这些问题,分别提供了检查数据库配置、调整nacos客户端版本、正确加载nacos配置以及启动类扫描注入等解决策略。
3633

被折叠的 条评论
为什么被折叠?



