public class Settings4jFactoryBean extends Object implements org.springframework.beans.factory.FactoryBean, org.springframework.beans.factory.InitializingBean
Settings4j.getObject(String)
.
Connector
-Implementation.
<bean id="MyConfigurableValue" class="org.settings4j.helper.spring.Settings4jFactoryBean"> <property name="key"><value>env/MyVariable</value></property> </bean>
<bean id="hibernateProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> <property name="locations"> <list> <value>classpath:org/settings4j/helper/spring/DefaultHibernate.properties</value> <bean class="org.settings4j.helper.spring.Settings4jFactoryBean"> <property name="key"> <value>env/MyCustomProprtiesLocationKey</value> </property> <property name="defaultObject"> <!-- This could also be an empty Property-File But it must Exist. --> <!-- PropertiesFactoryBean cannot handle invalid Paths. --> <value>classpath:org/settings4j/helper/spring/DefaultHibernate.properties</value> </property> </bean> </list> </property> </bean> <bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="db2Datasource2" /> <property name="hibernateProperties" ref="hibernateProperties" /> .... </bean>
Constructor and Description |
---|
Settings4jFactoryBean() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
Object |
getDefaultObject() |
Class |
getExpectedType()
Return the type that the configured object is supposed to be assignable to, if any.
|
String |
getKey() |
Object |
getObject() |
Class |
getObjectType() |
boolean |
isSingleton() |
void |
setDefaultObject(Object defaultObject) |
void |
setExpectedType(Class expectedType)
Specify the type that the configured object is supposed to be assignable to, if any.
|
void |
setKey(String key) |
void |
setSingleton(boolean singleton) |
public String getKey()
public void setKey(String key)
key
- - the Setting4j-Key for Your Configuration-Value.public void setSingleton(boolean singleton)
singleton
- - If true
, the Value will be read during SpringBean-Initialization. Default is
true
public void setExpectedType(Class expectedType)
expectedType
- the expected Class
.public Class getExpectedType()
public Object getDefaultObject()
public void setDefaultObject(Object defaultObject)
public Object getObject()
getObject
in interface org.springframework.beans.factory.FactoryBean
public Class getObjectType()
getObjectType
in interface org.springframework.beans.factory.FactoryBean
public boolean isSingleton()
isSingleton
in interface org.springframework.beans.factory.FactoryBean
public void afterPropertiesSet()
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Copyright © 2008–2014. All rights reserved.