legacy-knowledge-base
公開されました Sep. 10, 2025

カスタムポートレットからportal-ext.propertiesのデータを読み込む。

written-by

Thanga Meena

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

問題

  • カスタムモジュールやカスタムポートレットからportal-ext.propertiesファイルの設定されたプロパティを読み出すにはどうしたらよいですか?

Environment

  • Liferay DXP 7.1

解決策

ご注意:以下の手順は、Liferay サポートの範囲を超えたカスタマイズを伴います。 ご利用の際は、適切なご判断をお願いいたします。

  • portal-ext.propertiesを作成し、 $Liferay_Homeの下に配置します。
  • MVCポートレットを使用したサンプルプラグインの作成
  • PropsUtil.get("Name_of_the_property")を使えば、portal-ext.propertiesに定義されているプロパティの値を取得できるかもしれません。
  • 注:
    • name_of_the_propertyはportal-ext.propertiesで利用できるはずです。そうでなければ、null値を取得することになります。
    • portal-ext.properties ファイルは、 $Liferay_Home または $Tomcat_Home/webapps/ROOT/WEB-INF/cl フォルダ下に置くことができます。
    • Liferay は portal.properties ファイルの後に、 $Liferay_Homeで定義された portal-ext.properties ファイルからデータを読み取ります。 そして、 $Tomcat_Home/webapps/ROOT/WEB-INF/pass フォルダがあれば、そこから読み込むことになります。 最後にportal-setup-wizard.propertiesファイルから読み込む。

追加情報

did-this-article-resolve-your-issue

legacy-knowledge-base