简体   繁体   English

如何正确定位 Spring Context 属性占位符?

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

I am attempting to implement an outdated open-source Properties File Manager ( https://github.com/Confluex/Zuul/wiki ) with a Mule Test Application in MuleSoft's Anypoint Studio platform.我正在尝试使用 MuleSoft 的 Anypoint Studio 平台中的 Mule 测试应用程序实现一个过时的开源属性文件管理器 ( https://github.com/Confluex/Zuul/wiki )。 This appears to require the Spring Context Schema, but the project cannot locate it.这似乎需要 Spring Context Schema,但项目找不到它。 It continually states there is no 'context:property-placeholder'.它不断声明没有“上下文:属性占位符”。 I feel a versioning error may be the problem.我觉得版本错误可能是问题所在。 Here is my attempt:这是我的尝试:

<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>

Here is the error thrown:这是抛出的错误: 在此处输入图片说明

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.

Any advice would be much appreciated.任何建议将不胜感激。 Thanks.谢谢。

If you are trying to use the Mule 3 implementation in a Mule 4 it will fail, and that should be expected.如果您尝试在 Mule 4 中使用 Mule 3 实现,它将失败,这应该是意料之中的。 Mule 3 property placeholder providers where directly Spring property placeholder providers. Mule 3 属性占位符提供者直接在 Spring 属性占位符提供者那里。 Mule 4 uses a different way to implement them. Mule 4 使用不同的方式来实现它们。 <context:property-placeholder> doesn't exist in Mule 4. Its replacement <configuration-properties> will not work for this usage. <context:property-placeholder>在 Mule 4 中不存在。它的替代品<configuration-properties>不适用于这种用法。

Instead you will have to use Mule SDK for Java to develop a custom configuration property provider by implementing the ConfigurationPropertiesProviderFactory interface in a factory class and extending the DefaultConfigurationPropertiesProvider class to implement the provider.相反,您必须使用Mule SDK for Java通过在工厂类中实现 ConfigurationPropertiesProviderFactory 接口并扩展 DefaultConfigurationPropertiesProvider 类来实现提供程序来开发自定义配置属性提供程序。 In the provider you will need to use the Zuul library to implement the operations to get the keys and values.在提供程序中,您需要使用 Zuul 库来实现获取键和值的操作。

Instructions are available in the documentation: https://docs.mulesoft.com/mule-runtime/4.3/custom-configuration-properties-provider文档中提供了说明: 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