Closed ChiMuYuan closed 1 year ago
spring打包默认不打java目录下的xml文件的,挪到resource目录下去
@miemieYaho 这里的问题貌似不是没有打包啊...他报的应该是重复。比如我之前的BaseResultMap也是Result Maps collection already contains,然后我删掉就不报这个错了。 我参考的是https://baomidou.com/pages/f84a74/#%E8%87%AA%E5%AE%9A%E4%B9%89-sql-%E6%97%A0%E6%B3%95%E6%89%A7%E8%A1%8C 这里面的,在application.yml配置mapper-locations,在pom里面配置resource
这是由于mapper-locations配置的问题导致扫描出来了两份资源文件 修改一下为 mapper-locations: classpath:/mapper//xml/*.xml 就不会出问题,这个问题后面考虑下要不要处理一下.
好的谢谢
看着是spring加载资源问题,自行规避把,前面加上你的包名就没太多问题了. classpath*:com/example/**/mapper/**/xml/*.xml
当前使用版本(必填,否则不予处理)
spring-boot-starter-parent == 3.1.2 mybatis-plus-boot-starter == 3.5.3.2
该问题是如何引起的?(确定最新版也有问题再提!!!)
自定义 SQL中,自定义 ResultMap一对多:
在IDEA中本地运行没有问题,Maven打包为一个jar运行报错:Result Maps collection already contains value for ......... 因为使用MP生成器生成的XML中有BaseResultMap也爆这个错,但是没用到删除了。 现在是自写的也爆这个错
重现步骤(如果有就写完整)
最小复现项目地址 git@github.com:ChiMuYuan/demo.git https://github.com/ChiMuYuan/demo/tree/main/springboot3
报错信息
感谢👍