gpt4 book ai didi

java - 在类路径中找不到 Camel 属性文件

转载 作者:行者123 更新时间:2023-12-01 09:00:47 25 4
gpt4 key购买 nike

我尝试加载资源:src/com/company/my.properties,但在类路径上找不到它。

错误

Failed to create route route1: Route(route1)[[From[properties:{{fromroute}}]] ->
[Choice[[When[... because of Failed to resolve endpoint: properties://%7B%7Bfromroute%7D%7D due to:
Properties file com/company/my.properties not found in classpath
  • Camel 核心:2.18
  • Camel 属性阅读引用:Doc

my.properties 文件包含一个“fromroute”键:

fromroute=文件:/a/b

以下代码片段显示了我如何尝试加载文件。

PropertiesComponent pc = new PropertiesComponent();
pc.setLocation("classpath:com/company/my.properties");
context.addComponent("properties", pc);

....
from("properties:{{fromroute}}")
....

最佳答案

my.properties 文件应移至 src/main/resources (而不是 src/com/company)并更新 setLocation() 路径:

pc.setLocation("my.properties");

关于java - 在类路径中找不到 Camel 属性文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41691539/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com