Class BeanFactoryAspectInstanceFactory
- java.lang.Object
- org.springframework.aop.aspectj.annotation.BeanFactoryAspectInstanceFactory
- All Implemented Interfaces:
Serializable,MetadataAwareAspectInstanceFactory,AspectInstanceFactory,Ordered
- Direct Known Subclasses:
PrototypeAspectInstanceFactory
public class BeanFactoryAspectInstanceFactory extends Object implements MetadataAwareAspectInstanceFactory, Serializable
AspectInstanceFactoryimplementation backed by a SpringBeanFactory.Note that this may instantiate multiple times if using a prototype, which probably won't give the semantics you expect. Use a
LazySingletonAspectInstanceFactoryDecoratorto wrap this to ensure only one new aspect comes back.- Since:
- 2.0
- Author:
- Rod Johnson, Juergen Hoeller
- See Also:
BeanFactory,LazySingletonAspectInstanceFactoryDecorator, Serialized Form
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor Summary
Constructors Constructor Description BeanFactoryAspectInstanceFactory(BeanFactory beanFactory, String name)Create a BeanFactoryAspectInstanceFactory.BeanFactoryAspectInstanceFactory(BeanFactory beanFactory, String name, Class<?> type)Create a BeanFactoryAspectInstanceFactory, providing a type that AspectJ should introspect to create AJType metadata.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClassLoadergetAspectClassLoader()Expose the aspect class loader that this factory uses.ObjectgetAspectCreationMutex()Return the best possible creation mutex for this factory.ObjectgetAspectInstance()Create an instance of this factory's aspect.AspectMetadatagetAspectMetadata()Return the AspectJ AspectMetadata for this factory's aspect.intgetOrder()StringtoString()
Constructor Detail
BeanFactoryAspectInstanceFactory
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 to obtain instance(s) fromname- name of the bean
BeanFactoryAspectInstanceFactory
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 to obtain instance(s) fromname- the name of the beantype- the type that should be introspected by AspectJ
Method Detail
getAspectInstance
public Object getAspectInstance()
Description copied from interface:AspectInstanceFactoryCreate an instance of this factory's aspect.- Specified by:
getAspectInstancein interfaceAspectInstanceFactory- Returns:
- the aspect instance (never
null)
getAspectClassLoader
public ClassLoader getAspectClassLoader()
Description copied from interface:AspectInstanceFactoryExpose the aspect class loader that this factory uses.- Specified by:
getAspectClassLoaderin interfaceAspectInstanceFactory- Returns:
- the aspect class loader (never
null)
getAspectMetadata
public AspectMetadata getAspectMetadata()
Description copied from interface:MetadataAwareAspectInstanceFactoryReturn the AspectJ AspectMetadata for this factory's aspect.- Specified by:
getAspectMetadatain interfaceMetadataAwareAspectInstanceFactory- Returns:
- the aspect metadata
getAspectCreationMutex
public Object getAspectCreationMutex()
Description copied from interface:MetadataAwareAspectInstanceFactoryReturn the best possible creation mutex for this factory.- Specified by:
getAspectCreationMutexin interfaceMetadataAwareAspectInstanceFactory- Returns:
- the mutex object (may be
nullfor no mutex to use)
getOrder
public int getOrder()