|
From: Juergen H. <ju...@in...> - 2005-01-06 14:10:30
|
Colin, The class is there but it's called "ServiceLocatorProxyCreator". I prefer the name "ServiceLocatorProxyFactoryBean", as it's more in line with our naming conventions in general and with "(Transaction)ProxyFactoryBean" in general. Regarding the package where it resides: "org.springframework.aop.beans" is OK, I guess, but what's the general guideline for that package? We need to put package-level javadoc in there, explaining the purpose of the package in a sentence or two. I've also refined the implementation a bit: For no-arg locator methods, we should use BeanFactoryUtils.beanOfTypeIncludingAncestors to determine a single bean of the given type in the entire BeanFactory hierarchy. Furthermore, we should let the proxy's "toString" method say something like "Service locator: mypackage.MyServiceLocatorInterface". Should be easy to add via using a specific dummy target with overridden toString implementation for the proxy. Juergen -----Original Message----- From: spr...@li... [mailto:spr...@li...]On Behalf Of Colin Sampaleanu Sent: Wednesday, January 05, 2005 3:02 PM To: spr...@li... Subject: Re: [Springframework-developer] ServiceLocatorProxyFactoryBean Yes, I checked it into the main tree. But there's no real risk to it, it's a pretty small amount of code that doesn't affect anything else, and we're already using it in a project. Dmitriy Kopylenko wrote: > Colin, Juergen, > > are you planning to include this in 1.1.4? > > Dmitriy. > > Colin Sampaleanu wrote: > >> A few days ago I checked in ServiceLocatorProxyFactoryBean. I >> originally did a prototype version of this prompted by a couple of >> weblog entries by Mike Spille: >> >> http://www.pyrasun.com/mike/mt/archives/2004/11/06/15.46.14/index.html >> http://www.pyrasun.com/mike/mt/archives/2004/11/07/12.58.49/index.html >> >> Basically, the idea is that if somebody doesn't want to use the >> existing lookup method injection, because it seems too 'magic', they >> can instead define service locator interfaces like >> >> interface TestServiceLocator { >> TestService getTestService(); >> } >> >> or >> >> interface TestServiceLocator { >> TestService getTestService(String id); >> } >> >> Then the proxy factory actually creates an a proxy which implements >> the interface to internally do a normal getBean call and returns the >> object. This proxy can be injected into the client code to be used as >> needed. >> >> I put it in >> org.springframework.aop.beans >> since it depends on AOP classes. In some respects, that's not a great >> package, since this is not at all about AOP or even a generic proxy >> mechanism, but if it was included in the normal beans hierarchy it >> wouldn't have the dependent classes included with it in the base jar.. >> >> Colin >> >> >> >> ------------------------------------------------------- >> The SF.Net email is sponsored by: Beat the post-holiday blues >> Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. >> It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt >> _______________________________________________ >> Springframework-developer mailing list >> Spr...@li... >> https://lists.sourceforge.net/lists/listinfo/springframework-developer > > > > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer ------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |