01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tctest.spring.bean;
05:
06: import org.springframework.beans.BeansException;
07: import org.springframework.beans.factory.BeanFactory;
08: import org.springframework.beans.factory.BeanFactoryAware;
09: import org.springframework.beans.factory.BeanNameAware;
10: import org.springframework.beans.factory.InitializingBean;
11:
12: public class InitializingSingleton implements InitializingBean,
13: BeanNameAware, BeanFactoryAware {
14:
15: private Recorder recorder;
16: private String name;
17: private transient BeanFactory beanFactory;
18:
19: public void setRecorder(Recorder recorder) {
20: this .recorder = recorder;
21: }
22:
23: public void setBeanName(String name) {
24: this .name = name;
25: }
26:
27: public void setBeanFactory(BeanFactory beanFactory)
28: throws BeansException {
29: this .beanFactory = beanFactory;
30: }
31:
32: public void afterPropertiesSet() throws Exception {
33: recorder.addValue(name);
34: }
35: }
|