【问题标题】:How to pass boolean property to class mediator in WSO2 EI如何将布尔属性传递给 WSO2 EI 中的类中介
【发布时间】:2021-01-11 06:53:00
【问题描述】:

有没有办法将布尔参数传递给类中介?我尝试了以下代码块。

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}

【问题讨论】:

    标签: java class wso2 wso2esb wso2ei


    【解决方案1】:

    尝试使用属性中介。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-11-25
      • 1970-01-01
      • 2021-04-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多