KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tctest > spring > bean > InitializingSingleton


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tctest.spring.bean;
5
6 import org.springframework.beans.BeansException;
7 import org.springframework.beans.factory.BeanFactory;
8 import org.springframework.beans.factory.BeanFactoryAware;
9 import org.springframework.beans.factory.BeanNameAware;
10 import org.springframework.beans.factory.InitializingBean;
11
12
13 public class InitializingSingleton implements InitializingBean, BeanNameAware, BeanFactoryAware {
14
15   private Recorder recorder;
16   private String JavaDoc name;
17   private transient BeanFactory beanFactory;
18   
19   public void setRecorder(Recorder recorder) {
20     this.recorder = recorder;
21   }
22   
23   public void setBeanName(String JavaDoc name) {
24     this.name = name;
25   }
26   
27   public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
28     this.beanFactory = beanFactory;
29   }
30   
31   public void afterPropertiesSet() throws Exception JavaDoc {
32     recorder.addValue(name);
33   }
34 }
35
36
Popular Tags