Top Description Fields Constructors Methods
org.springframework.aop.aspectj.annotation

public Class BeanFactoryAspectInstanceFactory

extends Object
implements MetadataAwareAspectInstanceFactory, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.springframework.aop.aspectj.annotation.MetadataAwareAspectInstanceFactory, org.springframework.aop.aspectj.AspectInstanceFactory, org.springframework.core.Ordered
Known Direct Subclasses
org.springframework.aop.aspectj.annotation.PrototypeAspectInstanceFactory
Annotations
@SuppressWarnings:serial
Imports
java.io.Serializable, org.springframework.beans.factory.BeanFactory, org.springframework.beans.factory.config.ConfigurableBeanFactory, org.springframework.core.Ordered, org.springframework.core.annotation.OrderUtils, org.springframework.lang.Nullable, org.springframework.util.Assert, .ClassUtils

org.springframework.aop.aspectj.AspectInstanceFactory implementation backed by a Spring org.springframework.beans.factory.BeanFactory.

Note that this may instantiate multiple times if using a prototype, which probably won't give the semantics you expect. Use a LazySingletonAspectInstanceFactoryDecorator to wrap this to ensure only one new aspect comes back.

Authors
Rod Johnson, Juergen Hoeller
Since
2.0
See Also
org.springframework.beans.factory.BeanFactory, LazySingletonAspectInstanceFactoryDecorator

Field Summary

Modifier and TypeField and Description
private final AspectMetadata
private final BeanFactory
private final String

Constructor Summary

AccessConstructor and Description
public
BeanFactoryAspectInstanceFactory(BeanFactory
the BeanFactory to obtain instance(s) from
beanFactory
,
String
the name of the bean
name
)

Create a BeanFactoryAspectInstanceFactory.

public
BeanFactoryAspectInstanceFactory(BeanFactory
the BeanFactory to obtain instance(s) from
beanFactory
,
String
the name of the bean
name
,
Class<?>
the type that should be introspected by AspectJ (null indicates resolution through BeanFactory#getType via the bean name)
type
)

Create a BeanFactoryAspectInstanceFactory, providing a type that AspectJ should introspect to create AJType metadata.

Method Summary

Modifier and TypeMethod and Description
public ClassLoader
getAspectClassLoader()

Implements org.springframework.aop.aspectj.AspectInstanceFactory.getAspectClassLoader.

Expose the aspect class loader that this factory uses.
public Object
public Object
getAspectInstance()

Implements org.springframework.aop.aspectj.AspectInstanceFactory.getAspectInstance.

Create an instance of this factory's aspect.
public AspectMetadata
public int
getOrder()

Implements org.springframework.core.Ordered.getOrder.

Determine the order for this factory's target aspect, either an instance-specific order expressed through implementing the org.springframework.core.Ordered interface (only checked for singleton beans), or an order expressed through the org.springframework.core.annotation.Order annotation at the class level.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

aspectMetadataback to summary
private final AspectMetadata aspectMetadata
beanFactoryback to summary
private final BeanFactory beanFactory
nameback to summary
private final String name

Constructor Detail

BeanFactoryAspectInstanceFactoryback to summary
public BeanFactoryAspectInstanceFactory(BeanFactory beanFactory, String name)

Create a BeanFactoryAspectInstanceFactory. AspectJ will be called to introspect to create AJType metadata using the type returned for the given bean name from the BeanFactory.

Parameters
beanFactory:BeanFactory

the BeanFactory to obtain instance(s) from

name:String

the name of the bean

BeanFactoryAspectInstanceFactoryback to summary
public BeanFactoryAspectInstanceFactory(BeanFactory beanFactory, String name, Class<?> type)

Create a BeanFactoryAspectInstanceFactory, providing a type that AspectJ should introspect to create AJType metadata. Use if the BeanFactory may consider the type to be a subclass (as when using CGLIB), and the information should relate to a superclass.

Parameters
beanFactory:BeanFactory

the BeanFactory to obtain instance(s) from

name:String

the name of the bean

type:Class<?>

the type that should be introspected by AspectJ (null indicates resolution through BeanFactory#getType via the bean name)

Method Detail

getAspectClassLoaderback to summary
public ClassLoader getAspectClassLoader()

Implements org.springframework.aop.aspectj.AspectInstanceFactory.getAspectClassLoader.

Doc from org.springframework.aop.aspectj.AspectInstanceFactory.getAspectClassLoader.

Expose the aspect class loader that this factory uses.

Returns:ClassLoader

the aspect class loader (or null for the bootstrap loader)

Annotations
@Override
@Nullable
getAspectCreationMutexback to summary
public Object getAspectCreationMutex()

Implements org.springframework.aop.aspectj.annotation.MetadataAwareAspectInstanceFactory.getAspectCreationMutex.

Doc from org.springframework.aop.aspectj.annotation.MetadataAwareAspectInstanceFactory.getAspectCreationMutex.

Get the best possible creation mutex for this factory.

Returns:Object

the mutex object (may be null for no mutex to use)

Annotations
@Override
@Nullable
getAspectInstanceback to summary
public Object getAspectInstance()

Implements org.springframework.aop.aspectj.AspectInstanceFactory.getAspectInstance.

Doc from org.springframework.aop.aspectj.AspectInstanceFactory.getAspectInstance.

Create an instance of this factory's aspect.

Returns:Object

the aspect instance (never null)

Annotations
@Override
getAspectMetadataback to summary
public AspectMetadata getAspectMetadata()

Implements org.springframework.aop.aspectj.annotation.MetadataAwareAspectInstanceFactory.getAspectMetadata.

Doc from org.springframework.aop.aspectj.annotation.MetadataAwareAspectInstanceFactory.getAspectMetadata.

Get the AspectJ AspectMetadata for this factory's aspect.

Returns:AspectMetadata

the aspect metadata

Annotations
@Override
getOrderback to summary
public int getOrder()

Implements org.springframework.core.Ordered.getOrder.

Determine the order for this factory's target aspect, either an instance-specific order expressed through implementing the org.springframework.core.Ordered interface (only checked for singleton beans), or an order expressed through the org.springframework.core.annotation.Order annotation at the class level.

Returns:int

Doc from org.springframework.core.Ordered.getOrder.

the order value

Annotations
@Override
See Also
org.springframework.core.Ordered, org.springframework.core.annotation.Order
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override