这两个版本支持通配符设置配置文件了
spring的配置文件中设置如下:
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="ibatis/config/SqlMapConfig.xml" />
<property name="mappingLocations" value="ibatis/sqlmap/*.xml" />
<property name="dataSource" ref="dataSource" />
</bean>
ibatis的配置文件SqlMapConfig.xml中
<sqlMapConfig>
<settings cacheModelsEnabled="true" enhancementEnabled="true"
classInfoCacheEnabled="true" lazyLoadingEnabled="false" maxRequests="150"
maxSessions="100" maxTransactions="10" useStatementNamespaces="true" />
</sqlMapConfig>
但是启动的时候还是会报一个异常,SqlMapConfig.xml中必须满足
(properties?, settings?, resultObjectFactory?, typeAlias*, typeHandler*, transactionManager?, sqlMap+)+
的约束,这个一看就知道是dtd里的问题,所以就在ibatis的jar包,找到com.ibatis.sqlmap.engine.builder.xml下的sql-map-config-2.dtd
找到上面那句话,改成
(properties?, settings?, resultObjectFactory?, typeAlias*, typeHandler*, transactionManager?, sqlMap?)+
就可以了
IBATIS通配符配置
本文介绍如何在Spring和IBATIS框架中使用通配符进行配置文件的设置,并解决因DTD约束导致的异常问题。
1005

被折叠的 条评论
为什么被折叠?



