-
Feb 22nd, 2012, 12:15 PM
#1
Spring property loading depending on class that invokes
I have a abstract class AbstractService which has a reference to AbstractDAO
class AbstractService{
protected AbstractDAO abstractDAO;
}
AbstractService will be extended by actual service classes like ServiceClassA , ServiceClassB etc, and AbstractDAO will be extended by DaoClassA , DaoClassB etc.
Depending upon which class is extending AbstractService, abstractDAO should be an instance of DaoClassA , DaoClassB etc
I can achieve this by having the abstractDAO setter in the extending class like
class ServiceClassA{
@Autowired
@Qualifier("daoClassA")
public void setAbstractDAO(AbstractDAO abstractDAO) {
super.abstractDAO = abstractDAO;
}
}
Is there any way to have the setter setAbstractDAO in AbstractService class itself and abstractDAO gets Autowired depending upon the subclass maybe wth SPEL+Qualifier etc
We dont want to use any XML configuration for this
Thanks in Advance
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules