Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java apachecamel-Groovy脚本_Java_Groovy_Apache Camel - Fatal编程技术网

Java apachecamel-Groovy脚本

Java apachecamel-Groovy脚本,java,groovy,apache-camel,Java,Groovy,Apache Camel,我尝试在Spring DSL中使用Groovy脚本,如下所示: <from uri="file://{{my.path}}"> <choice> <when> <groovy>properties.resolve 'file.one.isActive' == 'true'</groovy> <to uri="file://{{file.one}}"/>

我尝试在Spring DSL中使用Groovy脚本,如下所示:

<from uri="file://{{my.path}}">
    <choice>
        <when>
            <groovy>properties.resolve 'file.one.isActive' == 'true'</groovy>
            <to uri="file://{{file.one}}"/>
        </when>
        <otherwise>
            <to uri="file://{{file.two}}"/>
        </otherwise>
    </choice>
</from>
我的pom.xml中有以下依赖项:

       <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-script</artifactId>
            <version>2.13.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-groovy</artifactId>
            <version>2.13.1</version>
        </dependency>

org.apache.camel
驼色文字
2.13.1
org.apache.camel
驼色沟槽
2.13.1
基于
http://camel.apache.org/groovy.html
我应该能够将
属性
引用与
解析
方法结合使用

知道哪里出了问题吗?

我认为它在解析之前正在评估('file.one.isActive'='true')。最好
解决'file.one.isActive'=='true'为清晰起见

我也遇到了同样的问题,所以为将来会遇到这个问题的其他人发布解决方案

尽管有信息说脚本上下文是用org.apache.camel.builder.script.PropertiesFunction类型的properties属性预配置的,但它并没有发生。 属性解析为交换属性。似乎是驼峰缺陷(使用驼峰2.16.1)

解决方法:

camelContext.resolvePropertyPlaceholders("{{file.one.isActive}}")
为此制造了一个问题
camelContext.resolvePropertyPlaceholders("{{file.one.isActive}}")