java - Why does this incorrect "package" tag in MyBatis XML config work? -
usually define our queries in xml files, , mappers portion of our mybatis xml config looks this:
<mappers>     <mapper resource="mappers/example1.xml"/>     <mapper resource="mappers/example2.xml"/> </mappers>   and fine.
now contributor added mappers java classes , have mixed configuration both xml files , java packages listed within mappers: 
<mappers>     <mapper resource="mappers/example1.xml"/>     <mapper resource="mappers/example2.xml"/>     <package name="it.example.mappers1" />     <package name="it.example.mappers2" /> </mappers>   i see document type definition http://ibatis.apache.org/dtd/ibatis-3-config.dtd not include package correct content mappers, , told eclipse, gives me error: 
the content of element type "mappers" must match "(mapper)+"
however, still works fine when run application. on other hand, when try remove incorrect package elements, mybatis doesn't know find mappers , runtime error:
org.apache.ibatis.binding.bindingexception: type interface it.example.mappers1.mymapper not known mapperregistry
so have wrong configuration works , necessary. why? specifying wrong dtd?
i indeed specifying old dtd ibatis. if replace correct http://mybatis.org/dtd/mybatis-3-config.dtd, validates , works. silly enough
Comments
Post a Comment