|
From: Colin S. <col...@ex...> - 2005-01-05 04:46:05
|
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 |