@DeprecatedSE public class PropertiesBeanDefinitionReader extends AbstractBeanDefinitionReader
Map/Properties および ResourceBundle の Bean 定義登録メソッドを提供します。通常、DefaultListableBeanFactory に適用されます。
例:
employee.(class)=MyClass // bean is of class MyClass employee.(abstract)=true // this bean can't be instantiated directly employee.group=Insurance // real property employee.usesDialUp=false // real property (potentially overridden) salesrep.(parent)=employee // derives from "employee" bean definition salesrep.(lazy-init)=true // lazily initialize this singleton bean salesrep.manager(ref)=tony // reference to another bean salesrep.department=Sales // real property techie.(parent)=employee // derives from "employee" bean definition techie.(scope)=prototype // bean is a prototype (not a shared instance) techie.manager(ref)=jeff // reference to another bean techie.department=Engineering // real property techie.usesDialUp=true // real property (overriding parent value) ceo.$0(ref)=secretary // inject 'secretary' bean as 0th constructor arg ceo.$1=1000000 // inject value '1000000' at 1st constructor arg
DefaultListableBeanFactory
修飾子と型 | フィールドと説明 |
---|---|
static StringSE | ABSTRACT_KEY 使用すべきではありません。 owner.(abstract)=true を区別する特別なキーデフォルトは "false" です。 |
static StringSE | CLASS_KEY 使用すべきではありません。 owner.(class)=com.myapp.MyClass を区別するための特別なキー。 |
static StringSE | CONSTRUCTOR_ARG_PREFIX 使用すべきではありません。 コンストラクター引数定義を示すために使用される接頭辞。 |
static StringSE | LAZY_INIT_KEY 使用すべきではありません。 owner.(lazy-init)=true を区別する特別なキーデフォルトは "false" です。 |
static StringSE | PARENT_KEY 使用すべきではありません。 owner.(parent)=parentBeanName を区別するための特別なキー。 |
static StringSE | REF_PREFIX 使用すべきではありません。 他の Bean を参照する値の前のプレフィックス。 |
static StringSE | REF_SUFFIX 使用すべきではありません。 現在の BeanFactory の他の Bean への参照のプロパティサフィックス。 |
static StringSE | SCOPE_KEY 使用すべきではありません。 owner.(scope)=prototype を区別するための特別なキー。 |
static StringSE | SEPARATOR 使用すべきではありません。 Bean 名とプロパティ名の間のセパレータ。 |
static StringSE | SINGLETON_KEY 使用すべきではありません。 owner.(singleton)=false を区別するための特別なキー。 |
static StringSE | TRUE_VALUE 使用すべきではありません。 true を表す T/F 属性の値。 |
logger
コンストラクターと説明 |
---|
PropertiesBeanDefinitionReader(BeanDefinitionRegistry registry) 使用すべきではありません。 指定された Bean ファクトリの新しい PropertiesBeanDefinitionReader を作成します。 |
修飾子と型 | メソッドと説明 |
---|---|
StringSE | getDefaultParentBean() 使用すべきではありません。 この Bean ファクトリのデフォルトの親 Bean を返します。 |
PropertiesPersister | getPropertiesPersister() 使用すべきではありません。 プロパティファイルの解析に使用する PropertiesPersister を返します。 |
int | loadBeanDefinitions(EncodedResource encodedResource) 使用すべきではありません。 指定されたプロパティファイルから Bean 定義をロードします。 |
int | loadBeanDefinitions(EncodedResource encodedResource, StringSE prefix) 使用すべきではありません。 指定されたプロパティファイルから Bean 定義をロードします。 |
int | loadBeanDefinitions(Resource resource) 使用すべきではありません。 すべてのプロパティキーを使用して、指定されたプロパティファイルから Bean 定義を読み込みます(つまり |
int | loadBeanDefinitions(Resource resource, StringSE prefix) 使用すべきではありません。 指定されたプロパティファイルから Bean 定義をロードします。 |
protected void | registerBeanDefinition(StringSE beanName, MapSE<?,?> map, StringSE prefix, StringSE resourceDescription) 使用すべきではありません。 プレフィックス(削除される)を指定してすべてのプロパティ値を取得し、それらが定義する Bean を指定の名前でファクトリに追加します。 |
int | registerBeanDefinitions(MapSE<?,?> map) 使用すべきではありません。 すべてのプロパティキーを使用して、マップに含まれる Bean 定義を登録します(つまり |
int | registerBeanDefinitions(MapSE<?,?> map, StringSE prefix) 使用すべきではありません。 マップに含まれる Bean 定義を登録します。 |
int | registerBeanDefinitions(MapSE<?,?> map, StringSE prefix, StringSE resourceDescription) 使用すべきではありません。 マップに含まれる Bean 定義を登録します。 |
int | registerBeanDefinitions(ResourceBundleSE rb) 使用すべきではありません。 すべてのプロパティキーを使用して、リソースバンドルに含まれる Bean 定義を登録します(つまり |
int | registerBeanDefinitions(ResourceBundleSE rb, StringSE prefix) 使用すべきではありません。 ResourceBundle に含まれる Bean 定義を登録します。 |
void | setDefaultParentBean(StringSE defaultParentBean) 使用すべきではありません。 この Bean ファクトリのデフォルトの親 Bean を設定します。 |
void | setPropertiesPersister(PropertiesPersister propertiesPersister) 使用すべきではありません。 プロパティファイルの解析に使用する PropertiesPersister を設定します。 |
getBeanClassLoader, getBeanFactory, getBeanNameGenerator, getEnvironment, getRegistry, getResourceLoader, loadBeanDefinitions, loadBeanDefinitions, loadBeanDefinitions, loadBeanDefinitions, setBeanClassLoader, setBeanNameGenerator, setEnvironment, setResourceLoader
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
public static final StringSE TRUE_VALUE
public static final StringSE SEPARATOR
public static final StringSE CLASS_KEY
owner.(class)=com.myapp.MyClass
を区別するための特別なキー。public static final StringSE PARENT_KEY
owner.(parent)=parentBeanName
を区別するための特別なキー。public static final StringSE SCOPE_KEY
owner.(scope)=prototype
を区別するための特別なキー。デフォルトは "true" です。public static final StringSE SINGLETON_KEY
owner.(singleton)=false
を区別するための特別なキー。デフォルトは "true" です。public static final StringSE ABSTRACT_KEY
owner.(abstract)=true
を区別する特別なキーデフォルトは "false" です。public static final StringSE LAZY_INIT_KEY
owner.(lazy-init)=true
を区別する特別なキーデフォルトは "false" です。public static final StringSE REF_SUFFIX
owner.dog(ref)=fido
。これがシングルトンまたはプロトタイプへの参照であるかどうかは、ターゲット Bean の定義に依存します。public static final StringSE REF_PREFIX
public PropertiesBeanDefinitionReader(BeanDefinitionRegistry registry)
registry
- Bean 定義を BeanDefinitionRegistry の形式でロードする BeanFactorypublic void setDefaultParentBean(@Nullable StringSE defaultParentBean)
使用できます。ビュー定義ファイルの場合は、デフォルトのビュークラスとすべてのビューの共通属性を持つ親を定義します。独自の親を定義するビュー定義または独自のクラスを持つビュー定義は、これをオーバーライドできます。
厳密に言うと、下位互換性の理由から、クラスを保持する Bean 定義にはデフォルトの親設定が適用されないというルールがあります。それでも、通常の使用例と一致します。
@Nullable public StringSE getDefaultParentBean()
public void setPropertiesPersister(@Nullable PropertiesPersister propertiesPersister)
public PropertiesPersister getPropertiesPersister()
public int loadBeanDefinitions(Resource resource) throws BeanDefinitionStoreException
resource
- プロパティファイルのリソース記述子 BeanDefinitionStoreException
- ロードまたは解析エラーの場合 loadBeanDefinitions(org.springframework.core.io.Resource, String)
public int loadBeanDefinitions(Resource resource, @Nullable StringSE prefix) throws BeanDefinitionStoreException
resource
- プロパティファイルのリソース記述子 prefix
- マップ内のキー内のフィルター: 例: 'Bean。' (空または null
にすることができます)BeanDefinitionStoreException
- ロードまたは解析エラーの場合 public int loadBeanDefinitions(EncodedResource encodedResource) throws BeanDefinitionStoreException
encodedResource
- プロパティファイルのリソース記述子。ファイルの解析に使用するエンコーディングを指定できます BeanDefinitionStoreException
- ロードまたは解析エラーの場合 public int loadBeanDefinitions(EncodedResource encodedResource, @Nullable StringSE prefix) throws BeanDefinitionStoreException
encodedResource
- プロパティファイルのリソース記述子。ファイルの解析に使用するエンコーディングを指定できます prefix
- マップ内のキー内のフィルター: 例: 'Bean。' (空または null
にすることができます)BeanDefinitionStoreException
- ロードまたは解析エラーの場合 public int registerBeanDefinitions(ResourceBundleSE rb) throws BeanDefinitionStoreException
rb
- ロードする ResourceBundleBeanDefinitionStoreException
- ロードまたは解析エラーの場合 registerBeanDefinitions(java.util.ResourceBundle, String)
public int registerBeanDefinitions(ResourceBundleSE rb, @Nullable StringSE prefix) throws BeanDefinitionStoreException
マップと同様の構文。このメソッドは、標準の Java 国際化サポートを有効にできます。
rb
- ロードする ResourceBundleprefix
- マップ内のキー内のフィルター: 例: 'Bean。' (空または null
にすることができます)BeanDefinitionStoreException
- ロードまたは解析エラーの場合 public int registerBeanDefinitions(MapSE<?,?> map) throws BeansException
map
- name
から property
へのマップ(文字列またはオブジェクト)。プロパティファイルなどから取得した場合、プロパティ値は文字列になります。プロパティ名(キー) は文字列でなければなりません。クラスキーは文字列でなければなりません。BeansException
- ロードまたは解析エラーの場合 registerBeanDefinitions(java.util.Map, String, String)
public int registerBeanDefinitions(MapSE<?,?> map, @Nullable StringSE prefix) throws BeansException
map
- name
から property
へのマップ(文字列またはオブジェクト)。プロパティファイルなどから取得した場合、プロパティ値は文字列になります。プロパティ名(キー) は文字列でなければなりません。クラスキーは文字列でなければなりません。prefix
- マップ内のキー内のフィルター: 例: 'Bean。' (空または null
にすることができます)BeansException
- ロードまたは解析エラーの場合 public int registerBeanDefinitions(MapSE<?,?> map, @Nullable StringSE prefix, StringSE resourceDescription) throws BeansException
map
- name
から property
へのマップ(文字列またはオブジェクト)。プロパティファイルなどから取得した場合、プロパティ値は文字列になります。プロパティ名(キー) は文字列でなければなりません。クラスキーは文字列でなければなりません。prefix
- マップ内のキー内のフィルター: 例: 'Bean。' (空または null
にすることができます)resourceDescription
- マップの元となったリソースの説明 (ロギング目的)BeansException
- ロードまたは解析エラーの場合 registerBeanDefinitions(Map, String)
protected void registerBeanDefinition(StringSE beanName, MapSE<?,?> map, StringSE prefix, StringSE resourceDescription) throws BeansException
beanName
- 定義する Bean の名前 map
- 文字列ペアを含むマップ prefix
- 削除される各エントリの接頭辞 resourceDescription
- マップの元となったリソースの説明 (ロギング目的)BeansException
- Bean 定義を解析または登録できなかった場合