Hi guys, I want to migrate many of my old xml spring configuration files to java annotations, and just leave there the complex configuration files.
The problem is that I'm not able to migrate the classes that I must extend to create a DAO implementation. Have tried lot of things about injecting a superclass property without success.
These are my configuration xml files...
These are my java files...Code:<bean id="CountriesDAO" class="com.citigroup.latam.edelivery.sm.database.oracle.OracleCountriesDAO"> <!-- This one is a superclass property --> <property name="dataSource" ref="RoutingDataSource"/> </bean> <bean id="RoutingDataSource" class="com.citigroup.latam.edelivery.sm.database.RoutingDataSource" > <property name="targetDataSources"> <map> <entry key="${database.ar.name}" value-ref="DataSourceBeanAR"/> <entry key="${database.mx.name}" value-ref="DataSourceBeanMX"/> </map> </property> </bean>
Code:public class OracleCountriesDAO extends JdbcDaoSupport implements CountriesDAO { public Map<T> getAll() {...} //... all CRUD methods ...// }Until here everything work fine.Code:public class RoutingDataSource extends AbstractRoutingDataSource { @Override protected Object determineCurrentLookupKey() { return DAOContextHolder.getCurrentSchema(); } }
But now, I want to annotate DAOs, so have removed the xml bean CountriesDAO and left RoutingDataSource (this one is an inherited property from JdbcDaoSupport).
I have tried the following java files...
Code:@Repository public class OracleCountriesDAO extends JdbcDaoSupport implements CountriesDAO { @Autowired public OracleCountriesDAO (RoutingDataSource routingDataSource){ super.setDataSource(routingDataSource); } }Actually, have tested all I found in forums but nothing worked and the following error appears all the time...Code:@Repository public class OracleCountriesDAO extends JdbcDaoSupport implements CountriesDAO { @Autowired public setRoutingDataSource (RoutingDataSource routingDataSource){ super.setDataSource(routingDataSource); } }
Have no idea how to fix this. The only clue I have, it's that have decompiled JdbcDaoSupport class and its method setDataSource is a final one, below is its signature:Injection of resource fields failed; nested exception is java.lang.NoSuchMethodError: org.springframework.core.MethodParameter.getParame terAnnotations()[Ljava/lang/Object;
public final void setDataSource(DataSource dataSource)
So guys, anybody can help me with this? Can't figure it out and it's very frustrating.
Hope to posted clear.
Thanks in advance.


Reply With Quote