mybatis的@MapperScan导致hessian无法使用,Invalid bound statement (not found)

现象:

spring-boot+mybatis+hessian进行整合的时候,client调用server端会报Invalid bound statement (not found)错误,这个错误来自mybatis。

原因:

根据hessian的使用方式,服务端和客户端都必须同时存在相同的接口。而mybatis配置的MapperScan会扫描指定的包,如果了解MapperScan注解,就应该明白,MapperScan会扫描指定包下的所有接口,注意是接口。如果mybatis发现接口中的方法没有绑定,就会报Invalid bound statement (not found)错误。

解决:

MapperScan注解扫描的包范围要精确一点,不要包含hessian的接口就可以了。

踩坑之路,一路成长。

发布了39 篇原创文章 · 获赞 33 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/love1793912554/article/details/104016944