open class PropertiesBeanDefinitionReader : AbstractBeanDefinitionReader
Bean definition reader for a simple properties format.
Provides bean definition registration methods for Map/Properties and ResourceBundle. Typically applied to a DefaultListableBeanFactory.
Example:
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
Author
Rod Johnson
Author
Juergen Hoeller
Author
Rob Harrop
Since
26.11.2003
See Also
DefaultListableBeanFactory
PropertiesBeanDefinitionReader(registry: BeanDefinitionRegistry)
Create new PropertiesBeanDefinitionReader for the given bean factory. |
static val ABSTRACT_KEY: String
Special key to distinguish |
|
static val CLASS_KEY: String
Special key to distinguish |
|
static val CONSTRUCTOR_ARG_PREFIX: String
Prefix used to denote a constructor argument definition. |
|
static val LAZY_INIT_KEY: String
Special key to distinguish |
|
static val PARENT_KEY: String
Special key to distinguish |
|
static val REF_PREFIX: String
Prefix before values referencing other beans. |
|
static val REF_SUFFIX: String
Property suffix for references to other beans in the current BeanFactory: e.g. |
|
static val SCOPE_KEY: String
Special key to distinguish |
|
static val SEPARATOR: String
Separator between bean name and property name. We follow normal Java conventions. |
|
static val SINGLETON_KEY: String
Special key to distinguish |
|
static val TRUE_VALUE: String
Value of a T/F attribute that represents true. Anything else represents false. Case seNsItive. |
open fun getDefaultParentBean(): String
Return the default parent bean for this bean factory. |
|
open fun getPropertiesPersister(): PropertiesPersister
Return the PropertiesPersister to use for parsing properties files. |
|
open fun loadBeanDefinitions(resource: Resource): Int
Load bean definitions from the specified properties file, using all property keys (i.e. not filtering by prefix). open fun loadBeanDefinitions(resource: Resource, prefix: String): Intopen fun loadBeanDefinitions(encodedResource: EncodedResource): Intopen fun loadBeanDefinitions(encodedResource: EncodedResource, prefix: String): Int
Load bean definitions from the specified properties file. |
|
open fun registerBeanDefinitions(rb: ResourceBundle): Int
Register bean definitions contained in a resource bundle, using all property keys (i.e. not filtering by prefix). open fun registerBeanDefinitions(rb: ResourceBundle, prefix: String): Int
Register bean definitions contained in a ResourceBundle. Similar syntax as for a Map. This method is useful to enable standard Java internationalization support. open fun registerBeanDefinitions(map: MutableMap<*, *>): Int
Register bean definitions contained in a Map, using all property keys (i.e. not filtering by prefix). open fun registerBeanDefinitions(map: MutableMap<*, *>, prefix: String): Intopen fun registerBeanDefinitions(map: MutableMap<*, *>, prefix: String, resourceDescription: String): Int
Register bean definitions contained in a Map. Ignore ineligible properties. |
|
open fun setDefaultParentBean(defaultParentBean: String): Unit
Set the default parent bean for this bean factory. If a child bean definition handled by this factory provides neither a parent nor a class attribute, this default value gets used. Can be used e.g. for view definition files, to define a parent with a default view class and common attributes for all views. View definitions that define their own parent or carry their own class can still override this. Strictly speaking, the rule that a default parent setting does not apply to a bean definition that carries a class is there for backwards compatibility reasons. It still matches the typical use case. |
|
open fun setPropertiesPersister(propertiesPersister: PropertiesPersister): Unit
Set the PropertiesPersister to use for parsing properties files. The default is DefaultPropertiesPersister. |
open fun getBeanClassLoader(): ClassLoader |
|
fun getBeanFactory(): BeanDefinitionRegistry |
|
open fun getBeanNameGenerator(): BeanNameGenerator |
|
open fun getEnvironment(): Environment |
|
fun getRegistry(): BeanDefinitionRegistry |
|
open fun getResourceLoader(): ResourceLoader |
|
open fun loadBeanDefinitions(vararg resources: Resource): Intopen fun loadBeanDefinitions(location: String): Intopen fun loadBeanDefinitions(vararg locations: String): Intopen fun loadBeanDefinitions(location: String, actualResources: MutableSet<Resource>): Int
Load bean definitions from the specified resource location. The location can also be a location pattern, provided that the ResourceLoader of this bean definition reader is a ResourcePatternResolver. |
|
open fun setBeanClassLoader(beanClassLoader: ClassLoader): Unit
Set the ClassLoader to use for bean classes. Default is |
|
open fun setBeanNameGenerator(beanNameGenerator: BeanNameGenerator): Unit
Set the BeanNameGenerator to use for anonymous beans (without explicit bean name specified). Default is a DefaultBeanNameGenerator. |
|
open fun setEnvironment(environment: Environment): Unit
Set the Environment to use when reading bean definitions. Most often used for evaluating profile information to determine which bean definitions should be read and which should be omitted. |
|
open fun setResourceLoader(resourceLoader: ResourceLoader): Unit
Set the ResourceLoader to use for resource locations. If specifying a ResourcePatternResolver, the bean definition reader will be capable of resolving resource patterns to Resource arrays. Default is PathMatchingResourcePatternResolver, also capable of resource pattern resolving through the ResourcePatternResolver interface. Setting this to |