abstract class AdviceModeImportSelector<A : Annotation> : ImportSelector
Convenient base class for ImportSelector implementations that select imports based on an AdviceMode value from an annotation (such as the |
|
open class AnnotatedBeanDefinitionReader
Convenient adapter for programmatic registration of annotated bean classes. This is an alternative to ClassPathBeanDefinitionScanner, applying the same resolution of annotations but for explicitly registered classes only. |
|
open class AnnotationBeanNameGenerator : BeanNameGenerator
org.springframework.beans.factory.support.BeanNameGenerator implementation for bean classes annotated with the org.springframework.stereotype.Component annotation or with another annotation that is itself annotated with org.springframework.stereotype.Component as a meta-annotation. For example, Spring's stereotype annotations (such as org.springframework.stereotype.Repository) are themselves annotated with org.springframework.stereotype.Component. Also supports Java EE 6's javax.annotation.ManagedBean and JSR-330's javax.inject.Named annotations, if available. Note that Spring component annotations always override such standard annotations. If the annotation's value doesn't indicate a bean name, an appropriate name will be built based on the short name of the class (with the first letter lower-cased). For example:
|
|
open class AnnotationConfigBeanDefinitionParser : BeanDefinitionParser
Parser for the <context:annotation-config/> element. |
|
open class AnnotationScopeMetadataResolver : ScopeMetadataResolver
A ScopeMetadataResolver implementation that by default checks for the presence of Spring's Scope annotation on the bean class. The exact type of annotation that is checked for is configurable via |
|
open class AutoProxyRegistrar : ImportBeanDefinitionRegistrar
Registers an auto proxy creator against the current BeanDefinitionRegistry as appropriate based on an |
|
open class ClassPathBeanDefinitionScanner : ClassPathScanningCandidateComponentProvider
A bean definition scanner that detects bean candidates on the classpath, registering corresponding bean definitions with a given registry ( Candidate classes are detected through configurable type filters. The default filters include classes that are annotated with Spring's org.springframework.stereotype.Component, org.springframework.stereotype.Repository, org.springframework.stereotype.Service, or org.springframework.stereotype.Controller stereotype. Also supports Java EE 6's javax.annotation.ManagedBean and JSR-330's javax.inject.Named annotations, if available. |
|
open class CommonAnnotationBeanPostProcessor : InitDestroyAnnotationBeanPostProcessor, InstantiationAwareBeanPostProcessor, BeanFactoryAware, Serializable
org.springframework.beans.factory.config.BeanPostProcessor implementation that supports common Java annotations out of the box, in particular the JSR-250 annotations in the This post-processor includes support for the javax.annotation.PostConstruct and javax.annotation.PreDestroy annotations - as init annotation and destroy annotation, respectively - through inheriting from InitDestroyAnnotationBeanPostProcessor with pre-configured annotation types. The central element is the javax.annotation.Resource annotation for annotation-driven injection of named beans, by default from the containing Spring BeanFactory, with only The JAX-WS javax.xml.ws.WebServiceRef annotation is supported too, analogous to javax.annotation.Resource but with the capability of creating specific JAX-WS service endpoints. This may either point to an explicitly defined resource by name or operate on a locally specified JAX-WS service class. Finally, this post-processor also supports the EJB 3 javax.ejb.EJB annotation, analogous to javax.annotation.Resource as well, with the capability to specify both a local bean name and a global JNDI name for fallback retrieval. The target beans can be plain POJOs as well as EJB 3 Session Beans in this case. The common annotations supported by this post-processor are available in Java 6 (JDK 1.6) as well as in Java EE 5/6 (which provides a standalone jar for its common annotations as well, allowing for use in any Java 5 based application). For default usage, resolving resource names as Spring bean names, simply define the following in your application context: For direct JNDI access, resolving resource names as JNDI resource references within the Java EE application's "java:comp/env/" namespace, use the following: mappedName references will always be resolved in JNDI, allowing for global JNDI names (including "java:" prefix) as well. The "alwaysUseJndiLookup" flag just affects name references and default names (inferred from the field name / property name).
NOTE: A default CommonAnnotationBeanPostProcessor will be registered by the "context:annotation-config" and "context:component-scan" XML tags. Remove or turn off the default annotation configuration there if you intend to specify a custom CommonAnnotationBeanPostProcessor bean definition! NOTE: Annotation injection will be performed before XML injection; thus the latter configuration will override the former for properties wired through both approaches. |
|
open class ComponentScanBeanDefinitionParser : BeanDefinitionParser
Parser for the |
|
open class ConfigurationClassPostProcessor : BeanDefinitionRegistryPostProcessor, PriorityOrdered, ResourceLoaderAware, BeanClassLoaderAware, EnvironmentAware
BeanFactoryPostProcessor used for bootstrapping processing of Configuration classes. Registered by default when using This post processor is |
|
interface ConfigurationCondition : Condition
A Condition that offers more fine-grained control when used with |
|
open class ContextAnnotationAutowireCandidateResolver : QualifierAnnotationAutowireCandidateResolver
Complete implementation of the org.springframework.beans.factory.support.AutowireCandidateResolver strategy interface, providing support for qualifier annotations as well as for lazy resolution driven by the Lazy annotation in the |
|
interface DeferredImportSelector : ImportSelector
A variation of ImportSelector that runs after all Implementations can also extend the org.springframework.core.Ordered interface or use the org.springframework.core.annotation.Order annotation to indicate a precedence against other DeferredImportSelectors. |
|
class FilterType
Enumeration of the type filters that may be used in conjunction with ComponentScan. |
|
open class Jsr330ScopeMetadataResolver : ScopeMetadataResolver
Simple ScopeMetadataResolver implementation that follows JSR-330 scoping rules: defaulting to prototype scope unless javax.inject.Singleton is present. This scope resolver can be used with ClassPathBeanDefinitionScanner and AnnotatedBeanDefinitionReader for standard JSR-330 compliance. However, in practice, you will typically use Spring's rich default scoping instead - or extend this resolver with custom scoping annotations that point to extended Spring scopes. |
|
interface LoadTimeWeavingConfigurer
Interface to be implemented by org.springframework.context.annotation.Configuration classes annotated with EnableLoadTimeWeaving that wish to customize the LoadTimeWeaver instance to be used. See org.springframework.scheduling.annotation.EnableAsync for usage examples and information on how a default |
|
open class MBeanExportConfiguration : ImportAware, EnvironmentAware, BeanFactoryAware
This configuration class is automatically imported when using the EnableMBeanExport annotation. See its javadoc for complete usage details. |
|
open class ScannedGenericBeanDefinition : GenericBeanDefinition, AnnotatedBeanDefinition
Extension of the org.springframework.beans.factory.support.GenericBeanDefinition class, based on an ASM ClassReader, with support for annotation metadata exposed through the AnnotatedBeanDefinition interface. This class does not load the bean |
class ComponentScans
Container annotation that aggregates several ComponentScan annotations. Can be used natively, declaring several nested ComponentScan annotations. Can also be used in conjunction with Java 8's support for repeatable annotations, where ComponentScan can simply be declared several times on the same method, implicitly generating this container annotation. |
|
class Conditional
Indicates that a component is only eligible for registration when all specified conditions match. A condition is any state that can be determined programmatically before the bean definition is due to be registered (see Condition for details). The
If a NOTE: Inheritance of |
|
class DependsOn
Beans on which the current bean depends. Any beans specified are guaranteed to be created by the container before this bean. Used infrequently in cases where a bean does not explicitly depend on another through properties or constructor arguments, but rather depends on the side effects of another bean's initialization. May be used on any class directly or indirectly annotated with org.springframework.stereotype.Component or on methods annotated with Bean. Using DependsOn at the class level has no effect unless component-scanning is being used. If a DependsOn-annotated class is declared via XML, DependsOn annotation metadata is ignored, and |
|
class Description
Adds a textual description to bean definitions derived from org.springframework.stereotype.Component or Bean. |
|
class EnableAspectJAutoProxy
Enables support for handling components marked with AspectJ's Where FooService is a typical POJO component and MyAspect is an @Aspect -style aspect: In the scenario above, @EnableAspectJAutoProxy ensures that MyAspect will be properly processed and that FooService will be proxied mixing in the advice that it contributes.
Users can control the type of proxy that gets created for
Note that Then use the @ComponentScan annotation to pick both up:
|
|
class EnableLoadTimeWeaving
Activates a Spring LoadTimeWeaver for this application context, available as a bean with the name "loadTimeWeaver", similar to the To be used on @org.springframework.context.annotation.Configuration classes; the simplest possible example of which follows: The example above is equivalent to the following Spring XML configuration: The LoadTimeWeaverAware interface Any bean that implements the interface will then receive the LoadTimeWeaver reference automatically; for example, Spring's JPA bootstrap support. Customizing the LoadTimeWeaver The default weaver is determined automatically: see DefaultContextLoadTimeWeaver.
To customize the weaver used, the
The example above can be compared to the following Spring XML configuration:
The code example differs from the XML example in that it actually instantiates the #aspectjWeaving() attribute, which will cause the to be registered through LoadTimeWeaver#addTransformer . AspectJ weaving will be activated by default if a "META-INF/aop.xml" resource is present on the classpath. Example:
The example above can be compared to the following Spring XML configuration:
The two examples are equivalent with one significant exception: in the XML case, the functionality of |
|
class EnableMBeanExport
Enables default exporting of all standard The resulting org.springframework.jmx.export.MBeanExporter bean is defined under the name "mbeanExporter". Alternatively, consider defining a custom AnnotationMBeanExporter bean explicitly. This annotation is modeled after and functionally equivalent to Spring XML's |
|
class ImportResource
Indicates one or more resources containing bean definitions to import. Like Import, this annotation provides functionality similar to the By default, arguments to the |
|
class Lazy
Indicates whether a bean is to be lazily initialized. May be used on any class directly or indirectly annotated with or on methods annotated with Bean. If this annotation is not present on a If Lazy is present on a Configuration class, this indicates that all In addition to its role for component initialization, this annotation may also be placed on injection points marked with org.springframework.beans.factory.annotation.Autowired or javax.inject.Inject: In that context, it leads to the creation of a lazy-resolution proxy for all affected dependencies, as an alternative to using org.springframework.beans.factory.ObjectFactory or javax.inject.Provider. |
|
class Primary
Indicates that a bean should be given preference when multiple candidates are qualified to autowire a single-valued dependency. If exactly one 'primary' bean exists among the candidates, it will be the autowired value. This annotation is semantically equivalent to the May be used on any class directly or indirectly annotated with
Because Note that using |
|
class Profile
Indicates that a component is eligible for registration when one or more specified profiles are active. A profile is a named logical grouping that may be activated programmatically via The
If a If a given profile is prefixed with the NOT operator ( If the NOTE: With When defining Spring beans via XML, the |
|
class PropertySources
Container annotation that aggregates several PropertySource annotations. Can be used natively, declaring several nested PropertySource annotations. Can also be used in conjunction with Java 8's support for repeatable annotations, where PropertySource can simply be declared several times on the same type, implicitly generating this container annotation. |
|
class Scope
When used as a type-level annotation in conjunction with org.springframework.stereotype.Component, When used as a method-level annotation in conjunction with Bean, In this context, scope means the lifecycle of an instance, such as To register additional custom scopes, see org.springframework.beans.factory.config.CustomScopeConfigurer. |
fun AnnotationConfigApplicationContext(configure: AnnotationConfigApplicationContext.() -> Unit): AnnotationConfigApplicationContext
Extension for AnnotationConfigApplicationContext allowing
|