01: /*
02: * Created on Aug 4, 2005
03: */
04: package uk.org.ponder.springutil;
05:
06: import org.springframework.beans.BeansException;
07: import org.springframework.beans.factory.BeanFactory;
08: import org.springframework.beans.factory.BeanFactoryAware;
09:
10: import uk.org.ponder.beanutil.BeanLocator;
11:
12: /**
13: * @author Antranig Basman (antranig@caret.cam.ac.uk)
14: *
15: */
16: public class SpringBeanLocator implements BeanLocator, BeanFactoryAware {
17: private BeanFactory factory;
18:
19: public SpringBeanLocator() {
20: }
21:
22: public SpringBeanLocator(BeanFactory factory) {
23: this .factory = factory;
24: }
25:
26: public Object locateBean(String beanname) {
27: return factory.getBean(beanname);
28: }
29:
30: public void setBeanFactory(BeanFactory factory)
31: throws BeansException {
32: this.factory = factory;
33: }
34:
35: }
|