Mar 21st, 2010, 07:54 AM
daoFactory design issue
I'm using Spting 2.5 along with ZK for Presentation layer. I have got a lot of DAOs, 44 to be precise to deal with.
My question is whether to use the daofactory patter as more or less all the Spring developers use or to go with a utility class called SpringUtil provided by ZK. ZK integrates with Spring and provides this class.
You can get any bean from this class in this form
One more question, are 44 daos(may increase later) large enough in number for me to refrain from using a separate daoFactory and use the below mentioned method?
So, basically it is a design issue that I must deal with.
Mar 22nd, 2010, 12:55 AM
I wonder why you need to use getBean at all.?. ideally wouldn't you just inject the dao into the class/bean requiring it's use (e.g. the service class).
Or maybe you have some special requirement. Sometimes if the class in which you need to utilize the dao can not be a spring bean, then that is one thing. But if it is a stateless singleton, then can you just inject the dao there and you don't ever have to call getBean? Even if you have state, you can use a prototype bean and inject it.. but then of course you'll prob have to use getBean on the prototype bean in the code so that new beans are created each time, but hopefully you're dealing with a singleton that won't have this issue.?.
OR.. maybe i'm missing the plot and having that many dao's makes it hard to inject them all so you're dynamically loading them or something? I've never worked on a project with that many so haven't hit that perhaps