浏览 1872 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2007-05-17
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="mappingResources"> <list> <value>pojo/Euser.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.Oracle9Dialect </prop> <prop key="hibernate.show_sql">true</prop> </props> </property> </bean> <bean id="baseDao" class="common.dao.BaseDaoImp"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="queryDao" class="common.dao.QueryDaoImp"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="userDAO" class="common.dao.UserDAO"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="pageQueryDao" class="common.dao.PageQueryDaoImp"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean name="baseService" class="common.BaseService"> <property name="baseDao" ref="baseDao" /> <property name="pageQueryDao" ref="pageQueryDao" /> <property name="queryDao" ref="queryDao" /> </bean> public class BaseService { protected BaseDao baseDao; protected PageQueryDao pageQueryDao; protected QueryDao queryDao; protected Log log = LogFactory.getLog(getClass()); /** * @param dao * The dao to set. */ public void setBaseDao(BaseDao dao) { this.baseDao = dao; } public void setPageQueryDao(PageQueryDao pageQueryDao) { this.pageQueryDao = pageQueryDao; } public void setQueryDao(QueryDao queryDao) { this.queryDao = queryDao; } } 以上是我的代码 !!!!! ApplicationContext context = new ClassPathXmlApplicationContext("xms-web.xml"); BaseService bs = (BaseService) context.getBean("baseService"); if(baseDao==null){ System.out.print("=========================="); } 总是 打印 ========================== 谁能指点指点 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |