3

プロパティファイルがあり、このファイルからルートに uri を設定したい:

   <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
           http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

        <import resource="TransactionsParserConfig.xml"/>

        <bean id="transactionsValidator" class="com.class.TransactionsValidator"/>
        <bean id="transactionsValidator123" name="${ftp.host}"/> <!--here I can use property-->


        <routeContext id="transactionsRoutes" xmlns="http://camel.apache.org/schema/spring">
            <route id="routeFTP">
                <from uri="direct:start" />
<!--here I can NOT use property-->
                <from uri="ftps://${ftp.host}/?securityProtocol=SSL"/>

etc...

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <array>
                <value>classpath:/ftp.properties</value>
            </array>
        </property>
    </bean>
</beans>

しかし、プロパティ ファイルから uri を設定することは許可されていないようです。${ftp.host} を routexContext タグの外側で使用すると、何も問題が発生しないためです。また、routeContext 内で ctrl+mouseclick を押しても、Idea でさえリダイレクトできません。なんで?

4

2 に答える 2

1

Spring の制限により、Camel は Spring DSL 内で PropertyPlaceholderConfigurer を使用できません。あなたが望むものを達成するための多くの方法があります。それらのいくつかは、リンクで説明されています。

于 2012-05-31T12:17:48.267 に答える