繁体   English   中英

如何将 boolean 属性传递给 WSO2 EI 中的 class 中介

[英]How to pass boolean property to class mediator in WSO2 EI

有没有办法将 boolean 参数传递给 class 中介? 我尝试使用以下代码块。

public class CustomMediator extends AbstractMediator {
    private String cacheEnabled;

    public boolean mediate(MessageContext messageContext) {}

    public String isCacheEnabled() {
        return cacheEnabled;
    }

    public void setCacheEnabled(String cacheEnabled) {
        this.cacheEnabled = cacheEnabled;
    }
}
<class name="lk.chathurabuddi.CustomMediator ">
    <property name="cacheEnabled" value="true"/>
</class>

但我收到以下运行时错误。

TID: [-1234] [] [2021-01-11 06:45:49,060] ERROR {org.apache.synapse.config.xml.PropertyHelper} -  Error invoking setter method named : setCacheEnabled() that takes a single String, int, long, float, double or boolean parameterargument type mismatch {org.apache.synapse.config.xml.PropertyHelper}

尝试使用财产调解员。

<class name="lk.chathurabuddi.CustomMediator">
 <property name="cacheEnabled" expression="$ctx:cacheEnabled"/>
</class>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM