the parent class is as follows:
public class BaseDAO{ private DBRoute defaultDB; public DBRoute getDefaultDB() { return this.defaultDB; } public void setDefaultDB(DBRoute defaultDB) { this.defaultDB = defaultDB; } }
I created beans as shown below:
<bean id="adsConfigDB" class="net.flyingfat.common.dbroute.config.DBRoute"> <constructor-arg value="adsConfig" /> </bean> <bean id="adsBizDateDB" class="net.flyingfat.common.dbroute.config.DBRoute"> <constructor-arg value="adsBizDate" /> </bean>
I want to add the superclass defaultDB property to a subclass via byName, and not by the type that is in the subclass, to insert defaultDB using adsConfigDB or adsBizDateDB . Is there a way to do this using spring annotations? I already tried Autwired or Resource with a constructor that doesn't work. By the way, I already know that this can be done using XML.
source share