検索

157.6. Blueprint XML を使用した例

download PDF

Blueprint XML では、以下に示す JasyptPropertiesParser を設定する必要があります。その後、Camel Properties コンポーネントは jasypt をプロパティーパーサーとして使用するよう指示されます。つまり、Jasypt はプロパティーで検索された値を復号化する機会を持っていることを意味します。

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
           xsi:schemaLocation="
           http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

  <cm:property-placeholder id="myblue" persistent-id="mypersistent">
      <!-- list some properties for this test -->
      <cm:default-properties>
          <cm:property name="cool.result" value="mock:{{cool.password}}"/>
          <cm:property name="cool.password" value="ENC(bsW9uV37gQ0QHFu7KO03Ww==)"/>
      </cm:default-properties>
  </cm:property-placeholder>

    <!-- define the jasypt properties parser with the given password to be used -->
    <bean id="jasypt" class="org.apache.camel.component.jasypt.JasyptPropertiesParser">
        <property name="password" value="secret"/>
    </bean>

    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
      <!-- define the camel properties placeholder, and let it leverage jasypt -->
      <propertyPlaceholder id="properties"
                           location="blueprint:myblue"
                           propertiesParserRef="jasypt"/>
        <route>
            <from uri="direct:start"/>
            <to uri="{{cool.result}}"/>
        </route>
    </camelContext>

</blueprint>

Properties コンポーネントは、以下に示す < camelContext > タグ内でインラインにすることもできます。propertiesParserRef 属性を使用して Jasypt を参照することに注意してください。

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
           xsi:schemaLocation="
           http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

    <!-- define the jasypt properties parser with the given password to be used -->
    <bean id="jasypt" class="org.apache.camel.component.jasypt.JasyptPropertiesParser">
        <property name="password" value="secret"/>
    </bean>

    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
      <!-- define the camel properties placeholder, and let it leverage jasypt -->
      <propertyPlaceholder id="properties"
                           location="classpath:org/apache/camel/component/jasypt/myproperties.properties"
                           propertiesParserRef="jasypt"/>
        <route>
            <from uri="direct:start"/>
            <to uri="{{cool.result}}"/>
        </route>
    </camelContext>

</blueprint>
Red Hat logoGithubRedditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

© 2024 Red Hat, Inc.