open class BeanDefinitionVisitor
Visitor class for traversing BeanDefinition objects, in particular the property values and constructor argument values contained in them, resolving bean metadata values. Used by PropertyPlaceholderConfigurer to parse all String values contained in a BeanDefinition, resolving any placeholders found. |
|
interface BeanExpressionResolver
Strategy interface for resolving a value through evaluating it as an expression, if applicable. A raw org.springframework.beans.factory.BeanFactory does not contain a default implementation of this strategy. However, org.springframework.context.ApplicationContext implementations will provide expression support out of the box. |
|
open class CustomEditorConfigurer : BeanFactoryPostProcessor, Ordered
BeanFactoryPostProcessor implementation that allows for convenient registration of custom PropertyEditor. In case you want to register PropertyEditor instances, the recommended usage as of Spring 2.0 is to use custom PropertyEditorRegistrar implementations that in turn register any desired editor instances on a given org.springframework.beans.PropertyEditorRegistry. Each PropertyEditorRegistrar can register any number of custom editors.
It's perfectly fine to register PropertyEditor classes via the
Note, that you shouldn't register PropertyEditor bean instances via the Also supports "java.lang.String[]"-style array class names and primitive class names (e.g. "boolean"). Delegates to ClassUtils for actual class name resolution. NOTE: Custom property editors registered with this configurer do not apply to data binding. Custom editors for data binding need to be registered on the org.springframework.validation.DataBinder: Use a common base class or delegate to common PropertyEditorRegistrar implementations to reuse editor registration there. |
|
open class CustomScopeConfigurer : BeanFactoryPostProcessor, BeanClassLoaderAware, Ordered
Simple BeanFactoryPostProcessor implementation that registers custom Scope with the containing ConfigurableBeanFactory. Will register all of the supplied This class allows for declarative registration of custom scopes. Alternatively, consider implementing a custom BeanFactoryPostProcessor that calls |
|
open class DeprecatedBeanWarner : BeanFactoryPostProcessor
Bean factory post processor that logs a warning for Deprecated beans. |
|
interface DestructionAwareBeanPostProcessor : BeanPostProcessor
Subinterface of BeanPostProcessor that adds a before-destruction callback. The typical usage will be to invoke custom destruction callbacks on specific bean types, matching corresponding initialization callbacks. |
|
open class EmbeddedValueResolver : StringValueResolver
StringValueResolver adapter for resolving placeholders and expressions against a ConfigurableBeanFactory. Note that this adapter resolves expressions as well, in contrast to the |
|
open class FieldRetrievingFactoryBean : FactoryBean<Any>, BeanNameAware, BeanClassLoaderAware, InitializingBean
FactoryBean which retrieves a static or non-static field value. Typically used for retrieving public static final constants. Usage example:
If you are using Spring 2.0, you can also use the following style of configuration for public static fields.
|
|
abstract class InstantiationAwareBeanPostProcessorAdapter : SmartInstantiationAwareBeanPostProcessor
Adapter that implements all methods on SmartInstantiationAwareBeanPostProcessor as no-ops, which will not change normal processing of each bean instantiated by the container. Subclasses may override merely those methods that they are actually interested in. Note that this base class is only recommendable if you actually require InstantiationAwareBeanPostProcessor functionality. If all you need is plain BeanPostProcessor functionality, prefer a straight implementation of that (simpler) interface. |
|
open class ListFactoryBean : AbstractFactoryBean<MutableList<Any>>
Simple factory for shared List instances. Allows for central setup of Lists via the "list" element in XML bean definitions. |
|
open class MapFactoryBean : AbstractFactoryBean<MutableMap<Any, Any>>
Simple factory for shared Map instances. Allows for central setup of Maps via the "map" element in XML bean definitions. |
|
open class MethodInvokingBean : ArgumentConvertingMethodInvoker, BeanClassLoaderAware, BeanFactoryAware, InitializingBean
Simple method invoker bean: just invoking a target method, not expecting a result to expose to the container (in contrast to MethodInvokingFactoryBean). This invoker supports any kind of target method. A static method may be specified by setting the This class depends on An example (in an XML based bean factory definition) of a bean definition which uses this class to call a static initialization method:
An example of calling an instance method to start some server bean:
|
|
open class MethodInvokingFactoryBean : MethodInvokingBean, FactoryBean<Any>
FactoryBean which returns a value which is the result of a static or instance method invocation. For most use cases it is better to just use the container's built-in factory method support for the same purpose, since that is smarter at converting arguments. This factory bean is still useful though when you need to call a method which doesn't return any value (for example, a static class method to force some sort of initialization to happen). This use case is not supported by factory methods, since a return value is needed to obtain the bean instance. Note that as it is expected to be used mostly for accessing factory methods, this factory by default operates in a singleton fashion. The first request to NOTE: If your target method does not produce a result to expose, consider MethodInvokingBean instead, which avoids the type determination and lifecycle limitations that this MethodInvokingFactoryBean comes with. This invoker supports any kind of target method. A static method may be specified by setting the This class depends on An example (in an XML based bean factory definition) of a bean definition which uses this class to call a static factory method:
An example of calling a static method then an instance method to get at a Java system property. Somewhat verbose, but it works.
|
|
open class ObjectFactoryCreatingFactoryBean : AbstractFactoryBean<ObjectFactory<Any>>
A org.springframework.beans.factory.FactoryBean implementation that returns a value which is an org.springframework.beans.factory.ObjectFactory that in turn returns a bean sourced from a org.springframework.beans.factory.BeanFactory. As such, this may be used to avoid having a client object directly calling A sample config in an XML-based org.springframework.beans.factory.BeanFactory might look as follows:
The attendant
An alternate approach to this application of an object creational pattern would be to use the ServiceLocatorFactoryBean to source (prototype) beans. The ServiceLocatorFactoryBean approach has the advantage of the fact that one doesn't have to depend on any Spring-specific interface such as org.springframework.beans.factory.ObjectFactory, but has the disadvantage of requiring runtime class generation. Please do consult the ServiceLocatorFactoryBean for a fuller discussion of this issue. |
|
open class PreferencesPlaceholderConfigurer : PropertyPlaceholderConfigurer, InitializingBean
Subclass of PropertyPlaceholderConfigurer that supports JDK 1.4's Preferences API ( Tries to resolve placeholders as keys first in the user preferences, then in the system preferences, then in this configurer's properties. Thus, behaves like PropertyPlaceholderConfigurer if no corresponding preferences defined. Supports custom paths for the system and user preferences trees. Also supports custom paths specified in placeholders ("myPath/myPlaceholderKey"). Uses the respective root node if not specified. |
|
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. |
|
open class PropertyOverrideConfigurer : PropertyResourceConfigurer
Property resource configurer that overrides bean property values in an application context definition. It pushes values from a properties file into bean definitions. Configuration lines are expected to be of the following form: Example properties file: In contrast to PropertyPlaceholderConfigurer, the original definition can have default values or no values at all for such bean properties. If an overriding properties file does not have an entry for a certain bean property, the default context definition is used.
Note that the context definition is not aware of being overridden; so this is not immediately obvious when looking at the XML definition file. Furthermore, note that specified override values are always literal values; they are not translated into bean references. This also applies when the original value in the XML bean definition specifies a bean reference. In case of multiple PropertyOverrideConfigurers that define different values for the same bean property, the last one will win (due to the overriding mechanism). Property values can be converted after reading them in, through overriding the |
|
open class PropertyPathFactoryBean : FactoryBean<Any>, BeanNameAware, BeanFactoryAware
FactoryBean that evaluates a property path on a given target object. The target object can be specified directly or via a bean name. Usage examples:
If you are using Spring 2.0 and XML Schema support in your configuration file(s), you can also use the following style of configuration for property path access. (See also the appendix entitled 'XML Schema-based configuration' in the Spring reference manual for more examples.) Thanks to Matthias Ernst for the suggestion and initial prototype!
|
|
open class PropertyPlaceholderConfigurer : PlaceholderConfigurerSupport
PlaceholderConfigurerSupport subclass that resolves ${...} placeholders against As of Spring 3.1, org.springframework.context.support.PropertySourcesPlaceholderConfigurer should be used preferentially over this implementation; it is more flexible through taking advantage of the org.springframework.core.env.Environment and org.springframework.core.env.PropertySource mechanisms also made available in Spring 3.1. PropertyPlaceholderConfigurer is still appropriate for use when:
Prior to Spring 3.1, the |
|
open class ProviderCreatingFactoryBean : AbstractFactoryBean<Provider<Any>>
A org.springframework.beans.factory.FactoryBean implementation that returns a value which is a JSR-330 javax.inject.Provider that in turn returns a bean sourced from a org.springframework.beans.factory.BeanFactory. This is basically a JSR-330 compliant variant of Spring's good old ObjectFactoryCreatingFactoryBean. It can be used for traditional external dependency injection configuration that targets a property or constructor argument of type |
|
open class RuntimeBeanNameReference : BeanReference
Immutable placeholder class used for a property value object when it's a reference to another bean name in the factory, to be resolved at runtime. |
|
open class RuntimeBeanReference : BeanReference
Immutable placeholder class used for a property value object when it's a reference to another bean in the factory, to be resolved at runtime. |
|
open class ServiceLocatorFactoryBean : FactoryBean<Any>, BeanFactoryAware, InitializingBean
A FactoryBean implementation that takes an interface which must have one or more methods with the signatures Such service locators permit the decoupling of calling code from the org.springframework.beans.factory.BeanFactory API, by using an appropriate custom locator interface. They will typically be used for prototype beans, i.e. for factory methods that are supposed to return a new instance for each call. The client receives a reference to the service locator via setter or constructor injection, to be able to invoke the locator's factory methods on demand. For singleton beans, direct setter or constructor injection of the target bean is preferable. On invocation of the no-arg factory method, or the single-arg factory method with a String id of On invocation of the single-arg factory method with a non-null (and non-empty) argument, the proxy returns the result of a A factory method argument will usually be a String, but can also be an int or a custom enumeration type, for example, stringified via By way of an example, consider the following service locator interface. Note that this interface is not dependent on any Spring APIs.
A sample config in an XML-based org.springframework.beans.factory.BeanFactory might look as follows:
The attendant
By way of an example that looks up a bean by name, consider the following service locator interface. Again, note that this interface is not dependent on any Spring APIs.
A sample config in an XML-based org.springframework.beans.factory.BeanFactory might look as follows:
The attendant
See ObjectFactoryCreatingFactoryBean for an alternate approach. |
|
open class SetFactoryBean : AbstractFactoryBean<MutableSet<Any>>
Simple factory for shared Set instances. Allows for central setup of Sets via the "set" element in XML bean definitions. |
|
open class TypedStringValue : BeanMetadataElement
Holder for a typed String value. Can be added to bean definitions in order to explicitly specify a target type for a String value, for example for collection elements. This holder will just store the String value and the target type. The actual conversion will be performed by the bean factory. |
|
open class YamlMapFactoryBean : YamlProcessor, FactoryBean<MutableMap<String, Any>>, InitializingBean
Factory for a YAML is a nice human-readable format for configuration, and it has some useful hierarchical properties. It's more or less a superset of JSON, so it has a lot of similar features. If multiple resources are provided the later ones will override entries in the earlier ones hierarchically; that is, all entries with the same nested key of type plus (later in the list) results in an effective input of Note that the value of "foo" in the first document is not simply replaced with the value in the second, but its nested values are merged.
|
|
open class YamlPropertiesFactoryBean : YamlProcessor, FactoryBean<Properties>, InitializingBean
Factory for java.util.Properties that reads from a YAML source, exposing a flat structure of String property values. YAML is a nice human-readable format for configuration, and it has some useful hierarchical properties. It's more or less a superset of JSON, so it has a lot of similar features. Note: All exposed values are of type The Properties created by this factory have nested paths for hierarchical objects, so for instance this YAML is transformed into these properties: Lists are split as property keys with [] dereferencers, for example this YAML: becomes properties like this:
|