如何解决蓝图属性占位符
这是我的蓝图:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd http://camel.apache.org/schema/blueprint https://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<bean class="ph.edu.dlsu.esb.CogMockProcessor" id="CogMockProcessor"/>
<cm:property-placeholder id="cogmock.properties"
persistent-id="custom.properties" update-strategy="reload">
<cm:default-properties>
<cm:property name="cogmock.host" value="//localhost"/>
<cm:property name="cogmock.port" value="8989"/>
<cm:property name="cogmock.path"
value="/external/grade/updatestudentgrade"/>
<cm:property name="cogmock.protocol" value="http"/>
<cm:property name="cogmock.OpenId.Token"
value="9GC1hnEeNIWVbehmxxjUwkj1Wcx2Y-P7SgOUZvVUzkM"/>
</cm:default-properties>
</cm:property-placeholder>
<camelContext id="_mockcontext" xmlns="http://camel.apache.org/schema/blueprint">
<route id="_route1">
<from id="_from1" uri="restlet:http://localhost:{{cogmock.port}}/external/grade/updatestudentgrade?restletMethod=POST">
<description>Mock the Camu Change of Grade API</description>
</from>
<process id="_process1" ref="CogMockProcessor"/>
<log id="_log1" message="I'm here"/>
</route>
</camelContext>
</blueprint>
这是我的 fuse-karaf/etc/custom.properties
#
# You can place any customized configuration here.
#
cogmock.protocol=http
cogmock.host=//localhost
cogmock.port=8989
cogmock.path=/external/grade/updatestudentgrade
cogmock.OpenId.Token=9GC1hnEeNIWVbehmxxjUwkj1Wcx2Y-P7SgOUZvVUzkM
它构建成功,但是当我 bundle:install -s ... 我得到:
Unable to start container for blueprint bundle CogMock/1.0.0.SNAPSHOT
如果我取出 {{cogmock.port}} 一切正常。
我错过了什么?
解决方法
仅当您使用
update-strategy="reload"
或更高版本时,才能将 xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
添加到您的蓝图 XML。它不适用于 xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
。
需要明确的是 persistent-id
属性表示 PID,它(当使用 etc/ 配置时)是从带有 *.cfg
扩展名的文件中创建的。因此,如果您有 persistent-id="cogmock"
,则需要带有属性的 $FUSE_HOME/etc/cogmock.cfg
文件。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。