public abstract class PropertyResourceConfigurer extends PropertiesLoaderSupport implements BeanFactoryPostProcessor, PriorityOrdered
ディストリビューションでは 2 つの具体的な実装が提供されています。
PropertyOverrideConfigurer (プロパティファイルから Bean 定義に値をプッシュする)PropertyPlaceholderConfigurer (Bean 定義にプロパティファイルから値をプルし ) プロパティ値は、convertPropertyValue(java.lang.String) メソッドをオーバーライドすることで、読み込んだ後で変換できます。例: 暗号化された値は、処理する前に検出および復号化できます。
PropertyOverrideConfigurer, PropertyPlaceholderConfigurerlocalOverride, localProperties, loggerHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE| コンストラクターと説明 |
|---|
PropertyResourceConfigurer() |
| 修飾子と型 | メソッドと説明 |
|---|---|
protected void | convertProperties(PropertiesSE props) 指定されたマージされたプロパティを変換し、必要に応じてプロパティ値を変換します。 |
protected StringSE | convertProperty(StringSE propertyName, StringSE propertyValue) 指定されたプロパティをプロパティソースから適用される値に変換します。 |
protected StringSE | convertPropertyValue(StringSE originalValue) 指定されたプロパティ値をプロパティソースから適用される値に変換します。 |
int | getOrder() このオブジェクトの順序値を取得します。 |
void | postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) |
protected abstract void | processProperties(ConfigurableListableBeanFactory beanFactory, PropertiesSE props) 特定のプロパティを特定の BeanFactory に適用します。 |
void | setOrder(int order) 並べ替えの目的で、このオブジェクトの順序値を設定します。 |
loadProperties, mergeProperties, setFileEncoding, setIgnoreResourceNotFound, setLocalOverride, setLocation, setLocations, setProperties, setPropertiesArray, setPropertiesPersistercloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSEpublic void setOrder(int order)
PriorityOrderedpublic int getOrder()
Ordered 値が高いほど、優先度は低くなります。結果として、最も低い値を持つオブジェクトが最高の優先度を持ちます(サーブレット load-on-startup の値に多少似ています)。
同じ順序の値は、影響を受けるオブジェクトの任意のソート位置になります。
Ordered の getOrder Ordered.HIGHEST_PRECEDENCE, Ordered.LOWEST_PRECEDENCEpublic void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
BeanFactoryPostProcessor の postProcessBeanFactory beanFactory - アプリケーションコンテキストで使用される Bean ファクトリ BeanInitializationException - プロパティをロードできない場合 BeansException - エラーの場合 protected void convertProperties(PropertiesSE props)
デフォルトの実装では、各プロパティ値に対して convertPropertyValue(java.lang.String) を呼び出し、元の値を変換された値で置き換えます。
props - 変換するプロパティ processProperties(org.springframework.beans.factory.config.ConfigurableListableBeanFactory, java.util.Properties)protected StringSE convertProperty(StringSE propertyName, StringSE propertyValue)
デフォルトの実装は convertPropertyValue(String) を呼び出します。
propertyName - 値が定義されているプロパティの名前 propertyValue - プロパティソースからの元の値 convertPropertyValue(String)protected StringSE convertPropertyValue(StringSE originalValue)
デフォルトの実装は、単に元の値を返します。たとえば、暗号化された値を検出し、それに応じて復号化するために、サブクラスでオーバーライドできます。
originalValue - プロパティソースからの元の値 (プロパティファイルまたはローカルの「プロパティ」)PropertiesLoaderSupport.setProperties(java.util.Properties), PropertiesLoaderSupport.setLocations(org.springframework.core.io.Resource...), PropertiesLoaderSupport.setLocation(org.springframework.core.io.Resource), convertProperty(String, String)protected abstract void processProperties(ConfigurableListableBeanFactory beanFactory, PropertiesSE props) throws BeansException
beanFactory - アプリケーションコンテキストで使用される BeanFactoryprops - 適用するプロパティ BeansException - エラーの場合