[quote=引用 22 楼 qq_25376897 的回复:]mybatis的xml文件和mapper接口不在相同包下时,需要用mapperLocations属性指定xml文件的路径
mybatis的xml文件和mapper接口不在相同包下时,需要用mapperLocations属性指定xml文件的路径
classpath:com/weiyi/context/mapper/xml/*.xml
[quote=引用 23 楼 Gong_xuesong 的回复:][quote=引用 22 楼 qq_25376897 的回复:]mybatis的xml文件和mapper接口不在相同包下时,需要用mapperLocations属性指定xml文件的路径
介意把你项目发给我看看吗 这样效率太低
# MyBatis mybatis: # 搜索指定包别名 typeAliasesPackage: com.weiyi # 配置mapper的扫描,找到所有的mapper.xml映射文件 mapperLocations: classpath*:mapper/**/*Mapper.xml
resources 新建一个文件夹, mapper文件复制过来 放在 resources 注意文件夹是新建的,而且只能是一级一级的 包创建 会是 com.aa.user 目录结构是 com/aa/user
81,090
社区成员
341,731
社区内容
加载中
试试用AI创作助手写篇文章吧