When configuring sql statements, can xml mapping and method annotations in mybatis coexist?
Cannot be set at the same time. The executor could not find the mapper proxy factory for the interface. Mybatis will parse the xml file first, encapsulate the parsed sql in mapperstament and put it into the configured mappedStatements, with namespace and method name (that is, id) as keywords, and mappedStatements are user-defined mappings. Then the proxy project of the interface is generated. After the production agent factory parses the annotation, it will also generate mapperstament and put it into the unified configuration object. However, when releasing, the user-defined mapping will first judge whether it exists, and if it exists, IllegalArgumentException will be thrown (name+"always contains the value of" +key "). However, when creating a proxy factory, you get an exception, so there will be no error when loading, but you will not generate a proxy factory for the interface. Without the proxy factory, there is no operational implementation class for the interface.