[英]Spring XD - properties file
我正在創建一個自定義的SpringXD處理器。 我正在嘗試從SpringXD流定義中讀取某些屬性,並從屬性文件中讀取其中一些屬性。 我的模塊XML中包含以下內容:
<context:property-placeholder location="classpath:config/myModule.properties" ignore-resource-not-found="true" system-properties-mode="OVERRIDE" />
<int:channel id="input"/>
<bean id="sessionProperties" class="com.mycompany.namespace.SomeConfigClassName">
<property name="hostNames" value="${hostNames}"/>
<property name="port" value="${port}"/>
</bean>
<int:transformer input-channel="input" output-channel="output">
<bean id="jmsTemplate" class="com.mycompany.namespace.ModuleClassName">
<property name="sessionProperties" ref="sessionProperties"/>
</bean>
</int:transformer>
<int:channel id="output"/>
我正在定義自己的信息流,如下所示:
stream create --name my-stream --definition "time | my-custom-module --port=1440 | log" --deploy
而且我不斷收到以下錯誤:
Command failed org.springframework.xd.rest.client.impl.SpringXDException: Error with option(s) for module my-custom-module of type processor:
port: option named 'port' is not supported
這是我的屬性文件的內容:
hostNames=foo.mycompany.com
有任何想法嗎?
我找到了解決問題的方法。 我將屬性文件與模塊的XML文件放在相同的路徑中。 Spring由於某種原因選擇了屬性文件,而忽略了XML文件。 將屬性文件移動到其他文件夾可解決此問題。
嘗試在部署流時通過輸入以下內容來指定屬性文件:
--propertiesFile myprops.properties
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.