| Home >> All >> org >> springframework >> [ beans Javadoc ] |
org.springframework.beans: Javadoc index of package org.springframework.beans.
Package Samples:
org.springframework.beans.factory.xml: The core package implementing Spring's lightweight Inversion of Control (IoC) container.
org.springframework.beans.support: This package contains interfaces and classes for manipulating Java beans.
org.springframework.beans.factory.access
org.springframework.beans.factory.config
org.springframework.beans.factory.support
org.springframework.beans.factory
org.springframework.beans.propertyeditors
Classes:
SingletonBeanFactoryLocator: Keyed-singleton implementation of BeanFactoryLocator, which leverages existing Spring constructs. This is normally accessed through DefaultLocatorFactory, but may also be used directly. Please see the warning in BeanFactoryLocator's javadoc about appropriate usage of singleton style BeanFactoryLocator implementations. It is the opinion of the Spring team that the use of this class and similar classes is unnecessary except (sometimes) for a small amount of glue code. Excessive usage will lead to code that is more tightly coupled, and harder to modify or test. In this implementation, a BeanFactory ...
MethodInvokingFactoryBean: 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 become the bean. Note that as it is expected to be used mostly for accessing ...
BeanFactory: The root interface for accessing a Spring IoC container. This interface is implemented by objects that hold a number of bean definitions, each uniquely identified by a String name. Depending on the bean definition, the factory will return either an independent instance of a contained object (the Prototype design pattern), or a single shared instance (a superior alternative to the Singleton design pattern, in which the instance is a singleton in the scope of the factory). Which type of instance will be returned depends on the bean factory configuration - the API is the same. The Singleton approach ...
PropertyPlaceholderConfigurer: A property resource configurer that resolves placeholders in bean property values of context definitions. It pulls values from a properties file into bean definitions. The default placeholder syntax follows the Ant / Log4J / JSP EL style: ${...} Example XML context definition: <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName"><value>${driver}</value></property> <property name="url"><value>jdbc:${dbname}</value></property> </bean> Example properties file: driver=com.mysql.jdbc.Driver ...
RefreshablePagedListHolder: RefreshablePagedListHolder is a PagedListHolder subclass with reloading capabilities. It automatically re-requests the List from the source provider, in case of Locale or filter changes. Data binding works just like with PagedListHolder. The locale can be specified in Locale's toString syntax, e.g. "locale=en_US". The filter object can be of any custom class, preferably a bean for easy data binding from a request. An instance will simply get passed through to PagedListSourceProvider.loadList. A filter property can be specified via "filter.myFilterProperty", for example. The scenario in the controller ...
ServiceLocatorFactoryBean: FactoryBean that takes an interface which must have one or more methods with the signatures MyType xxx() or MyType xxx(MyIdType id) (typically, MyService getService() or MyService getService(String id) ) and creates a dynamic proxy which implements that interface, delegating to the Spring BeanFactory underneath. Such service locator allow to decouple the caller from Spring BeanFactory API, 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 ...
PropertyPathFactoryBean: 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: // target bean to be referenced by name <bean id="tb" class="org.springframework.beans.TestBean" singleton="false"> <property name="age"><value>10</value></property> <property name="spouse"> <bean class="org.springframework.beans.TestBean"> <property name="age"><value>11</value></property> </bean> </property> </bean> // will result in 12, which is the value of property ...
BeanFactoryLocator: An interface for a class used to lookup/use, and optionally allow the release of a BeanFactory, or BeanFactory subclass such as ApplicationContext. Where this interface is implemented as a singleton class such as SingletonBeanFactoryLocator, the Spring team strongly suggests that it be used sparingly and with caution. By far the vast majority of the code inside an application is best written in a Dependency Injection style, where that code is served out of a BeanFactory/ApplicationContext container, and has its own dependencies supplied by the container when it is created. However, even such a ...
ListableBeanFactory: Extension of the BeanFactory interface to be implemented by bean factories that can enumerate all their bean instances, rather than attempting bean lookup by name one by one as requested by clients. BeanFactory implementations that preload all their beans (for example, DOM-based XML factories) may implement this interface. This interface is discussed in "Expert One-on-One J2EE Design and Development", by Rod Johnson. If this is a HierarchicalBeanFactory, the return values will not take any BeanFactory hierarchy into account, but will relate only to the beans defined in the current factory. Use ...
AbstractAutowireCapableBeanFactory: Abstract BeanFactory superclass that implements default bean creation, with the full capabilities specified by the RootBeanDefinition class. Implements the AutowireCapableBeanFactory interface. Like the base class AbstractBeanFactory, this superclass does not assume a listable bean factory. Provides bean creation (with constructor resolution), property population, wiring (including autowiring), and initialization. Handles runtime bean references, resolves managed collections, calls initialization methods, etc. Supports autowiring constructors, properties by name, and properties by type. The main ...
PropertyOverrideConfigurer: A 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: beanName.property=value Example properties file: dataSource.driverClassName=com.mysql.jdbc.Driver dataSource.url=jdbc:mysql:mydb 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 ...
PagedListHolder: PagedListHolder is a simple state holder for handling lists of objects, separating them into pages. Page numbering starts with 0. This is mainly targetted at usage in web UIs. Typically, an instance will be instantiated with a list of beans, put into the session, and exported as model. The properties can all be set/get programmatically, but the most common way will be data binding, i.e. populating the bean from request parameters. The getters will mainly be used by the view. Supports sorting the underlying list via a SortDefinition implementation, available as property "sort". By default, a MutableSortDefinition ...
AutowireCapableBeanFactory: Extension of the BeanFactory interface to be implemented by bean factories that are capable of autowiring, provided that they want to expose this functionality for existing bean instances. This subinterface of BeanFactory is not meant to be used in normal application code: stick to BeanFactory or ListableBeanFactory for typical use cases. Integration code for other frameworks can leverage this interface to wire and populate existing bean instances that Spring does not control the lifecycle of. This is particularly useful for WebWork Actions or Tapestry Page objects, for example. Note that this ...
BeanWrapperImpl: Default implementation of the BeanWrapper interface that should be sufficient for all typical use cases. Caches introspection results for efficiency. Note: This class never tries to load a class by name, as this can pose class loading problems in J2EE applications with multiple deployment modules. The caller is responsible for loading a target class. Note: Auto-registers default property editors from the org.springframework.beans.propertyeditors package, which apply in addition to the JDK's standard PropertyEditors. Applications can call BeanWrapper's registerCustomEditor method to register an ...
AbstractBeanFactory: Abstract superclass for BeanFactory implementations, implementing the ConfigurableBeanFactory SPI interface. Does not assume a listable bean factory: can therefore also be used as base class for bean factory implementations which fetch bean definitions from a variety of backend resources (where bean definition access is an expensive operation). This class provides singleton/prototype determination, singleton cache, aliases, FactoryBean handling, bean definition merging for child bean definitions, and bean destruction (DisposableBean interface, custom destroy methods). Furthermore, it can manage ...
PropertiesBeanDefinitionReader: 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 ...
ObjectFactoryCreatingFactoryBean: FactoryBean which returns a value which is an ObjectFactory that returns a bean from the BeanFactory. As such, this may be used to avoid having a client bean directly calling getBean() the BeanFactory to get a prototype bean out of the BeanFactory, a violation of inversion of control. Instead, with the use of this class, the client bean can be fed an ObjectFactory as a property which directly returns only the one target (usually prototype) bean. A Sample config in an XML BeanFactory might look as follows: <beans> <!-- Prototype bean since we have state --> <bean id="myService" class="a.b.c.MyService" ...
CustomEditorConfigurer: BeanFactoryPostProcessor implementation that allows for convenient registration of custom property editors. Configuration example, assuming XML bean definitions and inner beans for PropertyEditor instances: <bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer"> <property name="customEditors"> <map> <entry key="java.util.Date"> <bean class="mypackage.MyCustomDateEditor"/> </entry> <entry key="mypackage.MyObject"> <bean id="myEditor" class="mypackage.MyObjectEditor"> <property name="myParam"><value>myValue</value></property> ...
BeanWrapper: The central interface of Spring's low-level JavaBeans infrastructure; the default implementation is BeanWrapperImpl. Typically not directly used by application code but rather implicitly via a BeanFactory or a DataBinder. To be implemented by classes that can manipulate Java beans. Implementing classes have the ability to get and set property values (individually or in bulk), get property descriptors and query the readability and writability of properties. This interface supports nested properties enabling the setting of properties on subproperties to an unlimited depth. If a property update causes ...
XmlBeanFactory: Convenience extension of DefaultListableBeanFactory that reads bean definitions from an XML document. Delegates to XmlBeanDefinitionReader underneath; effectively equivalent to using an XmlBeanDefinitionReader with a DefaultListableBeanFactory. The structure, element and attribute names of the required XML document are hard-coded in this class. (Of course a transform could be run if necessary to produce this format). "beans" doesn't need to be the root element of the XML document: This class will parse all bean definition elements in the XML file. This class registers each bean definition with ...
PropertyResourceConfigurer: Allows for configuration of individual bean property values from a property resource, i.e. a properties file. Useful for custom config files targetted at system administrators that override bean properties configured in the application context. 2 concrete implementations are provided in the distribution: PropertyOverrideConfigurer for "beanName.property=value" style overriding ( pushing values from a properties file into bean definitions) PropertyPlaceholderConfigurer for replacing "${...}" placeholders ( pulling values from a properties file into bean definitions) Property values can be converted ...
DefaultListableBeanFactory: Default implementation of the ListableBeanFactory and BeanDefinitionRegistry interfaces: a full-fledged bean factory based on bean definitions. Typical usage is registering all bean definitions first (possibly read from a bean definition file), before accessing beans. Bean definition lookup is therefore an inexpensive operation in a local bean definition table. Can be used as a standalone bean factory, or as a superclass for custom bean factories. Note that readers for specific bean definition formats are typically implemented separately rather than as bean factory subclasses. For an alternative ...
CachedIntrospectionResults: Class to cache PropertyDescriptor information for a Java class. Package-visible; not for use by application code. Necessary as Introspector.getBeanInfo() in JDK 1.3 will return a new deep copy of the BeanInfo every time we ask for it. We take the opportunity to hash property descriptors by method name for fast lookup. Furthermore, we do our own caching of descriptors here, rather than rely on the JDK's system-wide BeanInfo cache (to avoid leaks on class loader shutdown). Information is cached statically, so we don't need to create new objects of this class for every JavaBean we manipulate. Thus ...
ChildBeanDefinition: Bean definition for beans who inherit settings from their parent. Will use the bean class of the parent if none specified, but can also override it. In the latter case, the child bean class must be compatible with the parent, i.e. accept the parent's property values and constructor argument values, if any. A child bean definition will inherit constructor argument values, property values and method overrides from the parent, with the option to add new values. If init method, destroy method and/or static factory method are specified, they will override the corresponding parent settings. The remaining ...
FactoryBean: Interface to be implemented by objects used within a BeanFactory that are themselves factories. If a bean implements this interface, it is used as a factory, not directly as a bean. NB: A bean that implements this interface cannot be used as a normal bean. A FactoryBean is defined in a bean style, but the object exposed for bean references is always the object that it creates. FactoryBeans can support singletons and prototypes, and can either create objects lazily on demand or eagerly on startup. This interface is heavily used within the framework, for example for the AOP ProxyFactoryBean or JndiObjectFactoryBean. ...
| Home | Contact Us | Privacy Policy | Terms of Service |