private static Logger logger = LoggerFactory.getLogger(LifecycleManagerUtils.class);
@SuppressWarnings("unchecked")
public static <T> ObjectFactory<T> createSingletonObjectFactory(T object) {
Class<T> cls = (Class<T>)object.getClass();
ClassMetadata classMetadata = collectClassMetadata(cls, false);
try {
CreationUtils.injectFields(object, classMetadata, null);
return new SingletonObjectFactory<T>(object);
} catch (IOException e) {
logger.error("Failed to inject fields of singleton {}", cls);