簡體   English   中英

如何正確定位 Spring Context 屬性占位符?

[英]How to properly locate Spring Context property-placeholder?

我正在嘗試使用 MuleSoft 的 Anypoint Studio 平台中的 Mule 測試應用程序實現一個過時的開源屬性文件管理器 ( https://github.com/Confluex/Zuul/wiki )。 這似乎需要 Spring Context Schema,但項目找不到它。 它不斷聲明沒有“上下文:屬性占位符”。 我覺得版本錯誤可能是問題所在。 這是我的嘗試:

<mule 
    xmlns="http://www.mulesoft.org/schema/mule/core" 
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:spring="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:zuul="zuul-spring-client-1.5.1"
    xsi:schemaLocation="
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
zuul-spring-client-1.5.1 zuul-spring-client-1.5.1.xsd">


        <context:property-placeholder properties-ref="MuleMeetZuul" />
    
</mule>

這是拋出的錯誤: 在此處輸入圖片說明

Caused by: org.mule.runtime.api.exception.MuleRuntimeException: There was '1' error while parsing the given file 'zuultest.xml'.
Full list:
org.xml.sax.SAXParseException; lineNumber: 17; columnNumber: 65; cvc-complex-type.2.4.a: Invalid content was found starting with element 'context:property-placeholder'. One of '{"http://www.mulesoft.org/schema/mule/core":annotations, "http://www.mulesoft.org/schema/mule/core":description, "http://www.mulesoft.org/schema/mule/core":global-property, "http://www.mulesoft.org/schema/mule/core":configuration, "http://www.mulesoft.org/schema/mule/core":notifications, "http://www.mulesoft.org/schema/mule/core":abstract-extension, "http://www.mulesoft.org/schema/mule/core":abstract-shared-extension, "http://www.mulesoft.org/schema/mule/core":abstract-mixed-content-extension, "http://www.mulesoft.org/schema/mule/core":abstract-security-manager, "http://www.mulesoft.org/schema/mule/core":abstract-transaction-manager, "http://www.mulesoft.org/schema/mule/core":abstract-shared-transaction-manager, "http://www.mulesoft.org/schema/mule/core":abstract-connector, "http://www.mulesoft.org/schema/mule/core":abstract-shared-connector, "http://www.mulesoft.org/schema/mule/core":abstract-global-endpoint, "http://www.mulesoft.org/schema/mule/core":abstract-exception-strategy, "http://www.mulesoft.org/schema/mule/core":abstract-on-error, "http://www.mulesoft.org/schema/mule/core":abstract-flow-construct, "http://www.mulesoft.org/schema/mule/core":flow, "http://www.mulesoft.org/schema/mule/core":sub-flow, "http://www.mulesoft.org/schema/mule/core":top-level-processor, "http://www.mulesoft.org/schema/mule/core":abstract-global-intercepting-message-processor, "http://www.mulesoft.org/schema/mule/core":abstract-object-store}' is expected.

任何建議將不勝感激。 謝謝。

如果您嘗試在 Mule 4 中使用 Mule 3 實現,它將失敗,這應該是意料之中的。 Mule 3 屬性占位符提供者直接在 Spring 屬性占位符提供者那里。 Mule 4 使用不同的方式來實現它們。 <context:property-placeholder>在 Mule 4 中不存在。它的替代品<configuration-properties>不適用於這種用法。

相反,您必須使用Mule SDK for Java通過在工廠類中實現 ConfigurationPropertiesProviderFactory 接口並擴展 DefaultConfigurationPropertiesProvider 類來實現提供程序來開發自定義配置屬性提供程序。 在提供程序中,您需要使用 Zuul 庫來實現獲取鍵和值的操作。

文檔中提供了說明: https : //docs.mulesoft.com/mule-runtime/4.3/custom-configuration-properties-provider

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM