我该如何告诉Spring运行init方法?我需要获得Proxied Async类并使用它进行一些初始化。Spring配置Init方法
@Configuration
@EnableAsync
public class Config {
@Bean
public AsyncBean asyncProxyBean(){
return new AsyncBean();
}
public void init(){
doStuffWithProxy(asyncProxyBean());
}
@Bean
public String thisIsHack(){ //this runs the init code but bean is a bit hacky
doStuffWithProxy(asyncProxyBean());
return "";
}
}
在我的情况下,代理是一个AsyncEventHandler,我需要注册与事件生产者的处理程序。 – 2012-01-04 22:35:41