Back Forum Reply New

@Autowired behavior overriding for fields

I wanted to create an automatic DAO implementation generator.

For example, if I had an autowired dao field as follows

Code:
public class MyService { @Autowired private IDAOlt;BookObjectgt; dao; // other service code follows
}
I wanted a way to automatically generate this DAO (mostly because for most entity classes the DAO is just CRUD stuff...). The simplest way of doing it would be to use a FactoryBean, which doesn't work in this case because there is no way of retrieving the type parameter from FactoryBean (A feature that would certainly be very useful indeed).

After looking through the dependency resolution code in the BeanFactory class hierarchy, it seems that short of overriding the BeanFactory (and ApplicationContext as well) there isn't any easy way of doing it (not to say overriding the ApplicationContext is particularly hard... just seems to be an overkill...)

I was just wondering if I was missing something (a thus, is there a better way?) or could we get a new feature to support type parameter retrieval from the FactoryBean?
¥
Back Forum Reply New