1.Invalid bound statement (not found): com.test.testdemo.mapper.UserMapper.Sel报错

解决方案:

1.查看Mapper.xml指向路径是否正确

 SpringBoot初次使用问题汇总

2.查看yml文件中的路径是否正确

SpringBoot初次使用问题汇总

2.Optional int parameter 'id' is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type.问题

 解决方案:入参的位置添加 @PathVariable 获取url中的参数SpringBoot初次使用问题汇总

@PathVariable的作用:

是用来对指定请求的URL路径里面的变量 

 {id}在这个请求的URL里就是个变量,可以使用@PathVariable来获取

 @PathVariable和@RequestParam的区别就在于:@RequestParam用来获得静态的URL请求参数;@PathVariable用来获得动态的URL请求入参

 

相关文章:

  • 2021-11-15
  • 2022-02-24
  • 2021-11-10
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-03
  • 2021-11-21
  • 2021-11-15
  • 2021-07-23
  • 2021-04-05
  • 2021-11-18
相关资源
相似解决方案