Invalid bound statement 数据无法绑定
详解链接此为缩略:
http://licocom.com/archives/831
Invalid bound statement (not found):com.example.demo.service.AreaService.ge
错误的意思是指,无法进行数据绑定,那么如何解决?
service与controller的接口绑定,错误绑定如下:分别为serviceimpl与controller的标注。
package serviceimpl; @Service public class AreaServiceImpl implements AreaService { } package controller; @Autowired private AreaService areaService; public String Map<>{ }
如上图的配置,访问就会产生错误,在serviceimpl层的标注@service,
与controller的@Autowire没有进行匹配的原因。
那么有两种修改方法,改正如上错误。
第一种:
package serviceimpl; @Service("name")//在这里要进行命令 public class AreaServiceImpl implements AreaService { } package controller; @Autowired//为自动识别 private AreaService name;//所以在这里必须写与service相同的命名,标注会自动检索。 public String Map<>{ }
第二种:
package serviceimpl; @Service("nameTest")//在这里要进行命名 public class AreaServiceImpl implements AreaService { } package controller; @Resource(name="nameTest")//手动检索serviceimpl接口 private AreaService everthing;//这里的命名可以将everthing替换为任何命名规则 public String Map<>{ }
以上两种方法都可解决此问题。
面向开发需求,记录学习之路♪(^∀^●)ノ