为什么classpath *:** / * Mapper.xml无法检索jar文件?

时间:2018-06-21 05:20:32

标签: spring spring-mvc spring-config

为什么无法通过classpath *:** / * Mapper.xml检索jar文件?

SqlSessionFactoryBean日志

    public void setMapperLocations(Resource[] mapperLocations) {


    for (Resource resource : mapperLocations) {

        log.debug("mapperLocations : {}", resource);
    }


    super.setMapperLocations(mapperLocations);
    this.mapperLocations = mapperLocations;
}
  1. 不搜索罐子。

context-datasource.xml

<bean id="example.sqlSession" class="org.mybatis.spring.SqlSessionFactoryBean">
  ..
  <property name="mapperLocations" value="classpath*:**/*Mapper.xml" />
</bean>

结果

mapperLocations : file [C:\project-KRISS\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp4\wtpwebapps\web.krisstar\WEB-INF\classes\kr\re\kriss\portal\requstCntrmsrCnter\service\impl\RequstCntrmsrCnterMapper.xml]
...
  1. 搜索罐子。

context-datasource.xml

<bean id="example.sqlSession" class="org.mybatis.spring.SqlSessionFactoryBean">
  ..
  <property name="mapperLocations">
    <list>
      <value>classpath*:/egovframework/com/**/*Mapper.xml</value>
      <value>classpath*:/egovframework/guide/**/*Mapper.xml</value>
      <value>classpath*:/egovframework/sample/**/*Mapper.xml</value>
      <value>classpath*:/kr/re/kriss/**/*Mapper.xml</value>
    </list>
  </property>
</bean>

结果

mapperLocations : file [C:\project-KRISS\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp4\wtpwebapps\web.krisstar\WEB-INF\classes\kr\re\kriss\portal\requstCntrmsrCnter\service\impl\RequstCntrmsrCnterMapper.xml]
mapperLocations : URL [jar:file:/C:/project-KRISS/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp4/wtpwebapps/web.krisstar/WEB-INF/lib/core.scheduler-1.0.0.jar!/kr/re/kriss/com/message/service/impl/PropertiesManageMapper.xml]
...

您在设置mapperLocations时遇到问题吗?

0 个答案:

没有答案