首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何正确定位Spring上下文属性占位符?

如何正确定位Spring上下文属性占位符?
EN

Stack Overflow用户
提问于 2021-07-29 03:36:20
回答 1查看 133关注 0票数 0

我正在尝试用MuleSoft的Anypoint Studio平台上的Mule测试应用程序实现一个过时的开源属性文件管理器(https://github.com/Confluex/Zuul/wiki)。这似乎需要Spring Context Schema,但项目找不到它。它不断地声明没有“context:property-placeholder”。我觉得版本控制错误可能是问题所在。这是我的尝试:

代码语言:javascript
运行
复制
<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>

下面是抛出的错误:

代码语言:javascript
运行
复制
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.

任何建议都将不胜感激。谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-07-29 22:55:50

如果您试图在Mule 4中使用Mule 3实现,那么它将失败,这应该是意料之中的。Mule 3属性占位符提供程序,其中直接Spring属性占位符提供程序。Mule4使用一种不同的方式来实现它们。在Mule4中不存在<context:property-placeholder>。它的替代<configuration-properties>将不适用于此用法。

相反,您必须使用Mule SDK for Java来开发自定义配置属性提供程序,方法是在工厂类中实现ConfigurationPropertiesProviderFactory接口,并扩展DefaultConfigurationPropertiesProvider类来实现提供程序。在提供者中,您将需要使用Zuul库来实现获取键和值的操作。

文档中提供了相关说明:https://docs.mulesoft.com/mule-runtime/4.3/custom-configuration-properties-provider

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68566439

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档