mybatis 怎么使用通配符配置 地图per

mybatis 如何使用通配符配置 mapper
本帖最后由 chen4246197 于 2015-09-30 16:10:31 编辑
springmvc+mybatis+mysql.我想配置mapper路径向下面这样。不用每次新建了一个 xml文件就添加一个。但是系统启动的时候报  Could not find resource cn/com/vobile/**/*_sqlmap_mysql.xml错误
<mappers>
<mapper resource="cn/com/vobile/**/*_sqlmap_mysql.xml" />
</mappers>

怎么解决
------解决思路----------------------
你的那个不能使用统配(ant匹配模式)。

例子:文档

<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
  <property name="dataSource" ref="dataSource" />
  <property name="mapperLocations" value="classpath*:sample/config/mappers/**/*.xml" />
</bean>


--
关于通用匹配是spring提供的ant匹配法,mybatis 没有这个功能。具体实现见:AntPathMatcher