1 4 package com.tctest.spring.bean; 5 6 import org.springframework.beans.factory.DisposableBean; 7 import org.springframework.beans.factory.InitializingBean; 8 9 public class DisposableService implements InitializingBean, DisposableBean { 10 11 private transient String name = "disposable"; 12 13 private transient String foo; 14 15 public transient static DisposableService afterPropertiesSetThis; 16 public transient static DisposableService destroyThis; 17 18 public String getName() { 19 return name; 20 } 21 22 public String getFoo() { 23 return foo; 24 } 25 26 public void afterPropertiesSet() throws Exception { 27 this.foo = "bar"; 28 afterPropertiesSetThis = this; 29 30 } 31 32 public void destroy() throws Exception { 33 this.name = null; 34 destroyThis = this; 35 if (foo == null) throw new RuntimeException ("foo is null"); 36 } 37 38 } 39 | Popular Tags |