1 4 package com.tctest.spring.bean; 5 6 import org.springframework.beans.factory.InitializingBean; 7 8 import com.tc.aspectwerkz.proxy.Uuid; 9 10 public class SimpleInitializingSingleton implements InitializingBean, ISimpleInitializingSingleton { 11 public static final String ME = "me"; 12 private transient long id = System.identityHashCode(this) + Uuid.newUuid(); 13 14 public static ISimpleInitializingSingleton afterPropertiesSetThis; 15 private String name; 16 17 public void afterPropertiesSet() throws Exception { 18 afterPropertiesSetThis = this; 19 this.name = ME; 20 } 21 22 public String getName() { 23 return name; 24 } 25 26 public long getId() { 27 return id; 28 } 29 30 public long getInnerId() { 31 return afterPropertiesSetThis.getId(); 32 } 33 34 public boolean isTheSameInstance() { 35 return afterPropertiesSetThis == this; 36 } 37 } 38 | Popular Tags |