camel 提供了 beforeApplicationStart 以及 afterApplicationStart 钩子函数,可以在camel启动前以及启动后做一些初始化等操作。
@Configuration
public class MyAppConfig {
private Logger logger = LoggerFactory.getLogger(MyAppConfig.class);
@Bean
CamelContextConfiguration contextConfiguration() {
return new CamelContextConfiguration() {
@Override
public void beforeApplicationStart(CamelContext camelContext) {
logger.info("准备启动");
}
@Override
public void afterApplicationStart(CamelContext camelContext) {
logger.info("启动成功");
}
};
}
}