在spring.config.xml中新加入一段:
<!--start yc -->
<bean id="ycDAOHibernate" class="com.vastis.ext.yc.dao.impl.YCDAOHibernateImpl">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<!--mssql 实现类-->
<bean id="ycDAOJDBC" class="com.vastis.ext.yc.dao.impl.YCDAOJDBCImpl">
<property name="dataSource">
<ref local="dataSource"/>
</property>
</bean>
<bean id="ycFacade" parent="JDBCDAOProxy">
<property name="target">
<bean class="com.vastis.ext.yc.service.impl.YCFacadeImpl">
<property name="ycDAOHibernate">
<ref bean="ycDAOHibernate"/>
</property>
<property name="ycDAOJDBC">
<ref bean="ycDAOJDBC"/>
</property>
</bean>
</property>
</bean>
<!--end yc-->
一开始总提示:
Bean property 'smsHistoryDao' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
折腾了半天,原来错误是在YCFacadeImpl文件中没有对ycDAOJDBC和ycDAOHibernate用get和set方法。
但是设了get和set方法后还是没用。
又仔细搜索了一番。
原来是YCDAOHibernateImpl和YCDAOJDBCImpl的继承还是老的接口,将它改成新的接口就可以啦。
对spring.config.xml的一些比较好的文章:
1)http://helloaq.iteye.com/blog/218227 含有ref的说明
2)http://hi.baidu.com/lynsahuang/blog/item/4dc04d3982de3123b9998fa4.html
3)http://hi.baidu.com/bigbig_88/blog/item/75ccc6a6e02376f99052eefc.html
4)http://www.cnblogs.com/hubcarl/archive/2011/04/28/2031711.html