springboot mybatis
1.必须要设置成mybatis.spring.mapper-locations=classpath:mapper/*.xml才能启动,但是 请求报错找不到mapper方法,
2.mybatis.mapper-locations和mybatis.spring.mapper-locations的区别是什么?
mapper.xml放在了resources/mapper下,
namespace和接口文件名一致,id和方法名一致,接口有@Mapper注解
不知道问题出在了哪里了
请求报这个错
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.example.demo.mapper.AddMapper.saveOne
直接把mapper.xml文件放在和mapper接口同包下依然不行,maven也清理和重新编译,xml文件修改空行也不行,网上各种方法都试了,求指导!
注:直接在mapper接口上用注解写sql可以成功
应该是用mybatis.mapper-locations,启动报错要看具体报什么错误,解决这些错误
把mapper.xml放在mapper接口同包下,然后修改classpath:mapper/*.xml 改成 classpath:com/example/demo/mapper/*.xml
是jdbcType的问题
和你遇到了一样的问题,就死活读方法的时候报错