CommonAnnotationBeanPostProcessor class

A marker in the post-processor chain that says where the @PostConstruct methods run.

It does nothing itself: when the factory reaches it in the chain, it runs the bean's @PostConstruct methods. It is PriorityOrdered with order Ordered.lowestPrecedence - 3, so @PostConstruct runs after the postProcessBeforeInitialization of the processors before it (PriorityOrdered ones with a smaller order, those added to the factory directly) and before the others (Ordered and plain ones), as in Spring. afterPropertiesSet and init methods still run after all of them. An application context registers it; on a bare factory without it, @PostConstruct runs after every postProcessBeforeInitialization. Add it to a bare factory to get the context's order.

factory.addBeanPostProcessor(CommonAnnotationBeanPostProcessor());

Spring (Java):

factory.addBeanPostProcessor(new CommonAnnotationBeanPostProcessor());
Inheritance
Implemented types

Constructors

CommonAnnotationBeanPostProcessor()
Creates the marker; it holds no state.

Properties

hashCode → int
The hash code for this object.
no setterinherited
order → int
Where this object goes: lower values come first. Values are usually small numbers, or offsets from highestPrecedence and lowestPrecedence.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
postProcessAfterInitialization(Object bean, String beanName) → Object
Called for each new bean after its init callbacks. The returned object (a proxy, say) is what the container exposes and injects. Also applied to FactoryBean products.
inherited
postProcessBeforeInitialization(Object bean, String beanName) → Object
Called for each new bean after injection and the aware callbacks, before the init callbacks (@PostConstruct, afterPropertiesSet, init method). Returns the object to go on with, usually bean itself.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

beanName → const String
The bean name an application context registers it under.