How to solve mybatis — Java lang.IllegalArgumentException: Result Maps collection already contains value for X

In the past two days, the project needs to integrate the three frameworks of spring, struts 2 and mybatis, but this error always occurs when starting, which puzzles me for a long time. The answers I find online are not what I want. Today, I finally know the reason.

user-mapper. The XML is as follows:

Where namespace is the interface path.

Mybatis. The XML is as follows:

If other configuration files are correct, I won't write them. Java. Net will appear Lang. illegalargumentexception: result maps collection already contains value for XXX.

The solution is: delete mybatis All the contents of the < mappers > tag in XML. Because if user mapper If the interfaces of XML and namespace are in the same path, they do not need to be in mybaits XML.

Modified mybatis The XML is as follows:

The above is how to solve mybatis -- Java Lang. illegalargumentexception: result maps collection already contains value for X. I hope it will help you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>