我正在使用 Main 类进行简单的 Java Camel 演示,并且需要为 Context 设置一个 PropertiesComponent,如下所示:
main.enableTrace();
main.enableHangupSupport();
main.addRouteBuilder(new RouteBuilderDemo());
CamelContext context = main.getOrCreateCamelContext();
PropertiesComponent pc = new PropertiesComponent();
pc.setLocation(“test.properties”);
context.addComponent("properties", pc);
当我运行时,我得到:
尚未配置现有的 PropertiesComponent,正在创建一个新的默认 PropertiesComponent,名称为:properties
我可以在不使用 Camel Main 帮助器的情况下完成此工作吗?
目前正在研究这种方法:How to add an EventNotifier to Camel using Main class standalone
最佳答案
这就是我的项目为 MainSupport 上下文绑定(bind) PropertiesComponent 的方式:
PropertiesComponent pc = new PropertiesComponent();
main.bind("properties", pc);
关于java - 使用Camel Main类时如何设置PropertiesComponent?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32186380/