Open source reader

Monday, April 24, 2006

A simple Spring bean retrieval convention

In his blog entry Ryan was talking about its switch to spring, and used such code for bean retrievals:
UserDAO dao = (UserDAO)DAOFactory.getDAO(DAOFactory.USER_DAO);

srini added a nice comment I am sharing with you

Typically, I just name the spring beans after the interface they represent for example...

<bean id="" class="">
<constructor-arg><ref bean="javax.jdo.PersistenceManagerFactory" /></constructor-arg>

So, when I have to look them up, I go...


Makes life easier while re-factoring as well. What conventions do you use ?
Like for log4j I do not like using such methods, I find the getName() not adding any value, Why not giving only the class ?


Unfortunately it is not handled in the api...


Post a Comment

<< Home