---
schema_version: "1"
id: 54a58cd2dd5dc9fa8bfcfb8f0883b7a57c54bbe93fe49e1dbfda986c98474e41
title: プロパティプレースホルダーの設定
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/mule-runtime/4.3/mule-app-properties-to-configure.md
canonical_url: https://docs.mulesoft.com/jp/mule-runtime/4.3/mule-app-properties-to-configure
source_site: docs.mulesoft.com
content_type: documentation
content_hash: a04523cc2bc964b75d8e9005f763b5c8f749b1278258c6af0271a8342311870a
description: MuleSoft Documentation Site
release: "4.3"
latest: false
---
# プロパティプレースホルダーの設定

接続をはじめとする Mule アプリケーション設定の静的値を使用する代わりに、​`.yaml`​ または ​`.properties`​ ファイルを作成してプロパティを格納し、アプリケーションからプロパティを参照することができます。

プロパティファイルを設定することで、アプリケーションの構成およびメンテナンス性が向上します。

`.yaml`​ ファイルでは、プロパティは次の形式になります。

```yaml
http:
  path: "/service"
  port: "10000"
  host: "my-api.cloudhub.io"
```

`.properties`​ ファイルでは、プロパティは次の形式になります。

http.path=/service
http.port=10000
http.host=my-api.cloudhub.io

## [](#プロパティファイルを作成して設定する)プロパティファイルを作成して設定する

1. Studio で ​**\[Package Explorer\]**​ ビューに移動して、プロジェクトの ​`/src/main/resources`​ フォルダーを右クリックします。
2. **\[New (新規)\]**​ > ​**\[File (ファイル)\]**​ を選択します。
    
    ![new-file-properties](/mulesoft/current/ja-jp/mule-runtime/4.3/_images/mruntime-properties-new-file.png)
3. ファイルの名前を選択して、拡張子を ​`.yaml`​ または ​`.properties`​ (この形式を使用する場合) に設定します。
4. ファイルを編集して、必要なプロパティおよび値を定義します。
5. プロパティファイルを Mule アプリケーションに追加します。
    
    - Studio から:
        
        1. **\[Global Elements (グローバル要素)\]**​ タブを開き、​**\[Create (作成)\]**​ ボタンをクリックします。
        2. 「Configuration Properties (設定プロパティ)」という名前の要素を検索し、​**\[OK\]**​ をクリックします。
        3. **\[…​\]**​ ボタンをクリックして、​`.yaml`​ または ​`.properties`​ ファイルに移動します。
    - XML エディターから:
        
        1. `<configuration-properties>`​ 要素を ​`<mule>`​ 内に含めて、プロパティファイル名を使用してその ​`file`​ パラメーターを設定します。例:
            
            ```xml
            <mule>
              <configuration-properties
                file="myConfiguration.yaml"
                doc:name="Configuration properties"
                doc:id="872422be-3571-4a52-a383-a2b0e16859d7" />`
              ...
            </mule>
            ```

## [](#アプリケーションでプロパティを使用する)アプリケーションでプロパティを使用する

プロパティファイルを設定してプロジェクトに追加したら、次のような構文を使用してその属性を参照できます: `${propertyContainer.propertyName}`​。

前のセクションで設定した例に基づくと、​`path`​ 値および ​`port`​ 値を使用するには、構文はそれぞれ ​`${http.path}`​ および ​`${http.port}`​ になります。

たとえば、グローバル HTTP 要求設定を設定してプロパティファイルで定義された値を使用できます。

- Studio から:

![properties-file](/mulesoft/current/ja-jp/mule-runtime/4.3/_images/mruntime-properties-file.png)

- XML エディターから
    
    ```xml
    <http:request-config
      name="HTTP_Request_config"
      doc:name="HTTP Request
      configuration" doc:id="7120494c-0540-4ad1-a118-f5b6db3f1456"
      basePath="${http.path}" >
    		<http:request-connection
          host="${http.host}"
          port="${http.port}" />
    </http:request-config>
    ```

## [](#関連情報)関連情報

- [プロパティの設定](https://docs.mulesoft.com/jp/mule-runtime/4.3/configuring-properties)