spring-framework / org.springframework.beans.factory.config / PropertiesFactoryBean

PropertiesFactoryBean

open class PropertiesFactoryBean : PropertiesLoaderSupport, FactoryBean<Properties>, InitializingBean

Allows for making a properties file from a classpath location available as Properties instance in a bean factory. Can be used to populate any bean property of type Properties via a bean reference.

Supports loading from a properties file and/or setting local properties on this FactoryBean. The created Properties instance will be merged from loaded and local values. If neither a location nor local properties are set, an exception will be thrown on initialization.

Can create a singleton or a new object on each request. Default is a singleton.

Author
Juergen Hoeller

See Also
#setLocation#setProperties#setLocalOverridejava.util.Properties

Constructors

<init>

PropertiesFactoryBean()

Allows for making a properties file from a classpath location available as Properties instance in a bean factory. Can be used to populate any bean property of type Properties via a bean reference.

Supports loading from a properties file and/or setting local properties on this FactoryBean. The created Properties instance will be merged from loaded and local values. If neither a location nor local properties are set, an exception will be thrown on initialization.

Can create a singleton or a new object on each request. Default is a singleton.

Functions

afterPropertiesSet

fun afterPropertiesSet(): Unit

getObject

fun getObject(): Properties

getObjectType

open fun getObjectType(): Class<Properties>

isSingleton

fun isSingleton(): Boolean

setSingleton

fun setSingleton(singleton: Boolean): Unit

Set whether a shared 'singleton' Properties instance should be created, or rather a new Properties instance on each request.

Default is "true" (a shared singleton).