骡子3 - 从.properties文件加载

Nar*_*hut 5 mule mule-studio

我正在使用Mule 3使用JDBC查询数据库,我想根据.properties文件的输入修改查询.我的xml中有这个...

<context:property-placeholder location="C:\path\to\file\settings.properties" />
Run Code Online (Sandbox Code Playgroud)

获得以下异常......

Exception in thread "main" org.mule.module.launcher.DeploymentInitException: SAXParseException: The prefix "context" for element "context:property-placeholder" is not bound.
Run Code Online (Sandbox Code Playgroud)

我是否需要包含一些特殊的.xsd文件?

use*_*178 7

将xmlns名称空间前缀和模式位置添加到Mule config mule元素标记中.

字首:

xmlns:context="http://www.springframework.org/schema/context"
Run Code Online (Sandbox Code Playgroud)

SCHEMALOCATION:

http://www.springframework.org/schema/context  http://www.springframework.org/schema/context/spring-context-3.0.xsd
Run Code Online (Sandbox Code Playgroud)

它应该如下所示.

例如:

<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:spring="http://www.springframework.org/schema/beans"      
    xmlns:http="http://www.mulesoft.org/schema/mule/http" 
    xmlns:context="http://www.springframework.org/schema/context"

    xsi:schemaLocation="
        http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.3/mule.xsd
        http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.3/mule-http.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
        http://www.springframework.org/schema/context  http://www.springframework.org/schema/context/spring-context-3.0.xsd      
        ">


<context:property-placeholder location="C:/path/to/file/settings.properties" />


  ...........  Other stuff



</mule>
Run Code Online (Sandbox Code Playgroud)