最初,我使用基于文件的bridgePropertyPlaceholder动态设置restConfiguration端口。
<bean id="bridgePropertyPlaceholder" class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>file:./connection_${ENV}.properties</value>
</list>
</property>
</bean>
<restConfiguration component="restlet" host="localhost" port="{{rest.port}}"/>
价值
${ENV}
{{rest.port}}
来自
connection_${ENV}.properties
连接${ENV}.properties
{{其余端口}}
到环境变量,我点击:
Caused by: java.lang.IllegalArgumentException: Property with key [rest.port] not found in properties from text: {{rest.port}}
<restConfiguration component="restlet" host="localhost" port="${rest.port}"/>
Caused by: org.apache.camel.TypeConversionException: Error during type conversion from type: java.lang.String to the required type: java.lang.Integer with value ${rest.port} due java.lang.NumberFormatException: For input string: "${rest.port}"
我的问题是:如何设置动态rest配置端口
使用基于文件的属性占位符?
备注:我知道存在使用javavm参数的解决方法(即-Drest.port=1234),但这种方法不是我想要的。