|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.beans.factory.support.AbstractBeanDefinitionReader org.springframework.beans.factory.support.PropertiesBeanDefinitionReader
Bean definition reader for a simple properties format. Provides bean definition registration methods for Map/Properties and ResourceBundle. Typically applied to a DefaultListableBeanFactory.
DefaultListableBeanFactory
Field Summary | |
static java.lang.String |
CLASS_KEY
Prefix for the class property of a root bean definition. |
static java.lang.String |
LAZY_INIT_KEY
Special string added to distinguish owner.(lazy-init)=true Default is false. |
protected org.apache.commons.logging.Log |
logger
|
static java.lang.String |
PARENT_KEY
Reserved "property" to indicate the parent of a child bean definition. |
static java.lang.String |
REF_PREFIX
Prefix before values referencing other beans. |
static java.lang.String |
REF_SUFFIX
Property suffix for references to other beans in the current BeanFactory: e.g. |
static java.lang.String |
SEPARATOR
Separator between bean name and property name. |
static java.lang.String |
SINGLETON_KEY
Special string added to distinguish owner.(singleton)=true Default is true. |
static java.lang.String |
TRUE_VALUE
Value of a T/F attribute that represents true. |
Constructor Summary | |
PropertiesBeanDefinitionReader(BeanDefinitionRegistry beanFactory)
Create new PropertiesBeanDefinitionReader for the given bean factory. |
Method Summary | |
java.lang.String |
getDefaultParentBean()
Return the default parent bean for this bean factory. |
int |
loadBeanDefinitions(Resource resource)
Load bean definitions from the specified properties file, using all property keys (i.e. |
int |
loadBeanDefinitions(Resource resource,
java.lang.String prefix)
Load bean definitions from the specified properties file. |
protected void |
registerBeanDefinition(java.lang.String beanName,
java.util.Map m,
java.lang.String prefix,
java.lang.String resourceDescription)
Get all property values, given a prefix (which will be stripped) and add the bean they define to the factory with the given name |
int |
registerBeanDefinitions(java.util.Map m)
Register bean definitions contained in a Map, using all property keys (i.e. |
int |
registerBeanDefinitions(java.util.Map m,
java.lang.String prefix)
Register bean definitions contained in a Map. |
int |
registerBeanDefinitions(java.util.Map m,
java.lang.String prefix,
java.lang.String resourceDescription)
Register bean definitions contained in a Map. |
int |
registerBeanDefinitions(java.util.ResourceBundle rb)
Register bean definitions contained in a resource bundle, using all property keys (i.e. |
int |
registerBeanDefinitions(java.util.ResourceBundle rb,
java.lang.String prefix)
Register bean definitions contained in a ResourceBundle. |
void |
setDefaultParentBean(java.lang.String defaultParentBean)
Set the default parent bean for this bean factory. |
Methods inherited from class org.springframework.beans.factory.support.AbstractBeanDefinitionReader |
getBeanClassLoader, getBeanFactory, setBeanClassLoader |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String TRUE_VALUE
public static final java.lang.String SEPARATOR
public static final java.lang.String CLASS_KEY
public static final java.lang.String SINGLETON_KEY
public static final java.lang.String LAZY_INIT_KEY
public static final java.lang.String PARENT_KEY
public static final java.lang.String REF_SUFFIX
public static final java.lang.String REF_PREFIX
protected final org.apache.commons.logging.Log logger
Constructor Detail |
public PropertiesBeanDefinitionReader(BeanDefinitionRegistry beanFactory)
Method Detail |
public void setDefaultParentBean(java.lang.String defaultParentBean)
Can be used e.g. for view definition files, to define a parent with common attributes for all views.
public java.lang.String getDefaultParentBean()
public int loadBeanDefinitions(Resource resource)
resource
- the resource descriptor for the properties file
BeansException
- in case of loading or parsing errorsloadBeanDefinitions(org.springframework.core.io.Resource, String)
public int loadBeanDefinitions(Resource resource, java.lang.String prefix)
resource
- the resource descriptor for the properties file
BeansException
- in case of loading or parsing errorspublic int registerBeanDefinitions(java.util.ResourceBundle rb) throws BeanDefinitionStoreException
BeansException
- in case of loading or parsing errors
BeanDefinitionStoreException
registerBeanDefinitions(java.util.ResourceBundle, String)
public int registerBeanDefinitions(java.util.ResourceBundle rb, java.lang.String prefix) throws BeanDefinitionStoreException
Similar syntax as for a Map. This method is useful to enable standard Java internationalization support.
BeansException
- in case of loading or parsing errors
BeanDefinitionStoreException
public int registerBeanDefinitions(java.util.Map m) throws BeansException
BeansException
- in case of loading or parsing errorsregisterBeanDefinitions(java.util.Map, String, String)
public int registerBeanDefinitions(java.util.Map m, java.lang.String prefix) throws BeansException
m
- Map name -> property (String or Object). Property values
will be strings if coming from a Properties file etc. Property names
(keys) must be strings. Class keys must be Strings.
employee.class=MyClass // special property
//employee.abstract=true // this prototype can't be instantiated directly
employee.group=Insurance Services // real property
employee.usesDialUp=false // default unless overriden
employee.manager(ref)=tony // reference to another prototype defined in the same file
// cyclic and unresolved references will be detected
salesrep.parent=employee
salesrep.department=Sales and Marketing
techie.parent=employee
techie.department=Software Engineering
techie.usesDialUp=true // overridden property
prefix
- The match or filter within the keys in the map: e.g. 'beans.'
BeansException
- in case of loading or parsing errorspublic int registerBeanDefinitions(java.util.Map m, java.lang.String prefix, java.lang.String resourceDescription) throws BeansException
m
- Map name -> property (String or Object). Property values
will be strings if coming from a Properties file etc. Property names
(keys) must be strings. Class keys must be Strings.prefix
- The match or filter within the keys in the map: e.g. 'beans.'resourceDescription
- description of the resource that the Map came from
(for logging purposes)
BeansException
- in case of loading or parsing errorsregisterBeanDefinitions(Map, String)
protected void registerBeanDefinition(java.lang.String beanName, java.util.Map m, java.lang.String prefix, java.lang.String resourceDescription) throws BeansException
beanName
- name of the bean to definem
- Map containing string pairsprefix
- prefix of each entry, which will be strippedresourceDescription
- description of the resource that the Map came from
(for logging purposes)
BeansException
- if the bean definition could not be parsed or registered
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |