gpt4 book ai didi

java - Camel .contains() 不从属性文件中搜索值

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

我需要在文件内搜索字符串,我使用了下面的java代码搜索字符串,它按我的预期工作,

.when(body().convertToString().contains("mytext"))

如果我需要更改搜索字符串,我必须再次重新编译代码,所以我尝试从属性文件加载搜索字符串,如下所示我在属性文件中定义了 findme='mytext' 但不会搜索带有“properties:{{findme}}”的字符串

.when(body().convertToString().contains("properties:{{findme}}"))

最佳答案

我认为应该是:

.when(body().convertToString().contains("{{findme}}"))

来自Apache Camel documentation on properties :

Syntax

The syntax to use Camel's property placeholder is to use {{key}} for example {{file.uri}} where file.uri is the property key. You can use property placeholders in parts of the endpoint URI's which for example you can use placeholders for parameters in the URIs.

关于java - Camel .contains() 不从属性文件中搜索值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41693710/

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