springcloud常见错误

  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

你可能感兴趣的:(IT资料)