使用 Camel Main class 时如何设置 PropertiesComponent?

How do I set PropertiesComponent when using Camel Main class?

我正在使用 Main class 进行简单的 Java camel 演示,需要为上下文设置 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 助手的情况下完成这项工作吗?

目前正在查看此方法:

这是我的项目为 MainSupport 上下文绑定 PropertiesComponent 的方式:

    PropertiesComponent pc = new PropertiesComponent();
    main.bind("properties", pc);