applicationContext.xml配置文件
action配置
<bean id="user" class="com.ssi.dev.action.UserAction">
<property name="userService">
<ref bean="userService"/>
</property>
</bean>
service配置
<bean id="userService" class="com.ssi.dev.service.UserService">
<property name="userDao">
<ref bean="userDao"/>
</property>
</bean>
我的dao层直接继承BaseDao
public class UserDao extends BaseDao {
public int dele() throws SQLException{
return super.delete("SC0101D01", "1");
}
}
BaseDao中获取SqlMapClient的实例
/**
* SqlMapClient的实例存储变量
*/
private SqlMapClient sqlMaperInstance = null;
/**
* 构造函数获取一个SqlMapClient的实例sqlMaperInstance
*/
public BaseDao() {
sqlMaperInstance = SqlMapClientFactory.getSqlMaper();
}
public int delete(String id, Object parameterObject) throws SQLException {
int resultCount = sqlMaperInstance.delete(id, parameterObject);
return resultCount;
}
同时我的applicationContext.xml文件中配置sqlMapClient为
<bean id="sqlMapClient"
class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="classpath:SqlMapConfig.xml" />
</bean>
问题:急需解答啊
我将在applicationContext.xml配置文件如何来配置我的userDao让他与上面的userService相关联
<bean id="userDao" class="com.ssi.dev.dao.UserDao">
<property name="XXX">
<ref bean="XXX"/>
</property>
</bean>
让xxx=sqlMapClient貌似不行没有这种写法啊因为我的UserDao种并没有property为sqlMapClient的
action配置
<bean id="user" class="com.ssi.dev.action.UserAction">
<property name="userService">
<ref bean="userService"/>
</property>
</bean>
service配置
<bean id="userService" class="com.ssi.dev.service.UserService">
<property name="userDao">
<ref bean="userDao"/>
</property>
</bean>
我的dao层直接继承BaseDao
public class UserDao extends BaseDao {
public int dele() throws SQLException{
return super.delete("SC0101D01", "1");
}
}
BaseDao中获取SqlMapClient的实例
/**
* SqlMapClient的实例存储变量
*/
private SqlMapClient sqlMaperInstance = null;
/**
* 构造函数获取一个SqlMapClient的实例sqlMaperInstance
*/
public BaseDao() {
sqlMaperInstance = SqlMapClientFactory.getSqlMaper();
}
public int delete(String id, Object parameterObject) throws SQLException {
int resultCount = sqlMaperInstance.delete(id, parameterObject);
return resultCount;
}
同时我的applicationContext.xml文件中配置sqlMapClient为
<bean id="sqlMapClient"
class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="classpath:SqlMapConfig.xml" />
</bean>
问题:急需解答啊
我将在applicationContext.xml配置文件如何来配置我的userDao让他与上面的userService相关联
<bean id="userDao" class="com.ssi.dev.dao.UserDao">
<property name="XXX">
<ref bean="XXX"/>
</property>
</bean>
让xxx=sqlMapClient貌似不行没有这种写法啊因为我的UserDao种并没有property为sqlMapClient的