对spring与ibatis结合的补充
如果 sql-map-config.xml 是写在类中,需要从classpath路径读取时:
?
实现类:
?
public class sSqlMapClientFactoryBean extends SqlMapClientFactoryBean {
?public void setConfigLocation(String configLocation) {
??Resource rs = new UrlResource(
?? Thread.currentThread().getContextClassLoader().getResource(configLocation));
??super.setConfigLocation(rs);
?}
}
?
在spring配置中这样配置
?
<bean id="sqlMapClient"
??????? />
??? </property>???????
? </bean>