springcloud常见错误

本文深入解析HTTP状态码400、404、405、415及500错误的原因,涵盖Feign接口、MyBatisPlus、SpringCloud、MyBatis配置不当引发的问题,并提供针对性的解决策略。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  1. Unsatisfied dependency expressed through field
    feign 接口参数注解RequestParam,应写成RequestParam(“userName”)

  2. mybatisplus,mybatis 会默认链接数据库
    需要配置datasource,4属性,否则报not dataSource 错误

  3. Required String parameter ‘userName’ is not present 属性类的参数不能加@RequestParam注解

  4. 415错误:页面调用的第一个控制层参数 属性类对象,因为页面传过来是json参数

  5. 400错误:页面调用的第一个控制层 属性类列参数 不能加注解,或注解名字

  6. 服务端控制层不加注解,会提示新增成功,但获取不到参数

  7. 405错误:post方法等调用不匹配,如URL为get请求,只能访问getMapping

  8. springcloud中,getMapping请求传参为属性类对象时,请求类型会 默认成为POST,然后报405错误,所以get方式不能传对象

  9. 404错误: 路径错误,很可能是注解名不匹配

  10. 500错误:后台代码报错,需根据错误具体分析,
    如:路径参数应该用@PathVariable,却使用了request如路径参数应该用@PathVariable,却使用了request
    如:控制层加了@RequestParam注解,参数默认初始化没有此参数 等等·······

  11. 使用mybatis时分页栏有问题,可能是pagehelper版本太低

  12. 版本冲突,jar包损坏 问题最为常见
    如:有依赖非springboot集成依赖,本该mybatis-plus-boot-starter ,实际下载成 mybatis-plus
    Unsatisfied dependency expressed through field ‘service’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘sqlServiceImpl’: Unsatisfied dependency expressed through field ‘empMapper’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘empMapper’ defined in file [E:\SpringCloudFeign\SPRINGCLOUD_SERVICE\target\classes\cn\ps\mapper\EmpMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值