项目编译时,报错如下:
Caused by: org.apache.ibatis.type.TypeException: The alias 'xxx' is already mapped to the value 'com.demo.xxx'.
at org.apache.ibatis.type.TypeAliasRegistry.registerAlias(TypeAliasRegistry.java:151)
at org.apache.ibatis.type.TypeAliasRegistry.registerAlias(TypeAliasRegistry.java:144)
at org.apache.ibatis.type.TypeAliasRegistry.registerAliases(TypeAliasRegistry.java:133)
at org.apache.ibatis.type.TypeAliasRegistry.registerAliases(TypeAliasRegistry.java:122)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.typeAliasesElement(XMLConfigBuilder.java:118)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:99)
... 64 more
修改方法很简单,可以修改配置文件中的包路径,或者修改其中一个类名。
从mybatis源码的角度分析该错误的来源,请查看大牛文章:
http://my.oschina.net/zimingforever/blog/478137