Làm cách nào để tôi có thể yêu cầu Spring chạy phương thức init đó? Tôi cần phải có được lớp Proxied Async và làm một số khởi tạo với nó.Cấu hình Spring Init Method
@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 "";
}
}
Trong trường hợp của tôi các proxy là một AsyncEventHandler và tôi cần phải đăng ký xử lý với nhà sản xuất sự kiện. –