package com.doctor.esper.spring;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

/**
 * @see org.opencredo.esper.spring.EsperTemplateBean
 * 
 * @author doctor
 *
 * @time 2015年6月8日 下午5:16:51
 */
public class EsperTemplateBean extends EsperTemplate implements BeanNameAware, InitializingBean, DisposableBean {
	private final static Logger LOG = LoggerFactory.getLogger(EsperTemplateBean.class);

	public void setBeanName(String name) {
		super.setName(name);
		LOG.debug("Set esper template bean name to " + name);
	}

	public void afterPropertiesSet() {
		LOG.debug("Initializing the esper template bean");
		super.initialize();
		LOG.debug("Completed initializing the esper template bean");
	}

	public void destroy() {
		LOG.debug("Destroying the esper template bean");
		super.cleanup();
		LOG.debug("Finished destroying the esper template bean");
	}
}

@@ -38,228 +38,132 @@
 ort 
-org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0Aimport org.springframework.beans.factory.BeanNameAware;%0Aimport org.springframework.beans.factory.DisposableBean;%0Aimport org.springframework.beans.factory.InitializingBean
+javax.annotation.PostConstruct;%0Aimport javax.annotation.PreDestroy;%0A%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory
 ;%0A%0A/
@@ -333,67 +333,8 @@
 ate 
-implements BeanNameAware, InitializingBean, DisposableBean 
 %7B%0A%09p
@@ -422,129 +422,22 @@
 ;%0A%0A%09
-public void setBeanName(String name) %7B%0A%09%09super.setName(name);%0A%09%09LOG.debug(%22Set esper template bean name to %22 + name);%0A%09%7D%0A
+@PostConstruct
 %0A%09pu
@@ -611,16 +611,29 @@
 %22);%0A%09%7D%0A%0A
+%09@PreDestroy%0A
 %09public 

use javax.annotation.PostConstruct;javax.annotation.PreDestroy;