在类路径中找不到骆驼属性文件 [英] Camel properties file not found in class path
本文介绍了在类路径中找不到骆驼属性文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正试图加载资源:src/com/company/my.properties
,但是在类路径上找不到它.
I am tring to load the resource: src/com/company/my.properties
, but it can't be found on the classpath.
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
- 骆驼芯:2.18
- 骆驼属性请参阅:文档
- camel core:2.18
- camel properties read refer : Doc
my.properties
文件包含一个"fromroute"键:
The my.properties
file contains a 'fromroute' key:
fromroute=file:/a/b
以下代码片段显示了我如何尝试加载文件.
The following snippet shows how I'm trying to load the file.
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()
路径:
my.properties
file should be moved in to src/main/resources
(not src/com/company
)
and update the setLocation()
path:
pc.setLocation("my.properties");
这篇关于在类路径中找不到骆驼属性文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文