Class SimpleAspectInstanceFactory

java.lang.Object
org.springframework.aop.aspectj.SimpleAspectInstanceFactory
All Implemented Interfaces:
AspectInstanceFactory, Ordered
Direct Known Subclasses:
SimpleMetadataAwareAspectInstanceFactory

public class SimpleAspectInstanceFactory extends Object implements AspectInstanceFactory
Implementation of AspectInstanceFactory that creates a new instance of the specified aspect class for every getAspectInstance() call.
Since:
2.0.4
Author:
Juergen Hoeller
  • Constructor Details

    • SimpleAspectInstanceFactory

      public SimpleAspectInstanceFactory(Class<?> aspectClass)
      Create a new SimpleAspectInstanceFactory for the given aspect class.
      Parameters:
      aspectClass - the aspect class
  • Method Details

    • getAspectClass

      public final Class<?> getAspectClass()
      Return the specified aspect class (never null).
    • getAspectInstance

      public final Object getAspectInstance()
      Description copied from interface: AspectInstanceFactory
      Create an instance of this factory's aspect.
      Specified by:
      getAspectInstance in interface AspectInstanceFactory
      Returns:
      the aspect instance (never null)
    • getAspectClassLoader

      @Nullable public ClassLoader getAspectClassLoader()
      Description copied from interface: AspectInstanceFactory
      Expose the aspect class loader that this factory uses.
      Specified by:
      getAspectClassLoader in interface AspectInstanceFactory
      Returns:
      the aspect class loader (or null for the bootstrap loader)
      See Also:
    • getOrder

      public int getOrder()
      Determine the order for this factory's aspect instance, either an instance-specific order expressed through implementing the Ordered interface, or a fallback order.
      Specified by:
      getOrder in interface Ordered
      Returns:
      the order value
      See Also:
    • getOrderForAspectClass

      protected int getOrderForAspectClass(Class<?> aspectClass)
      Determine a fallback order for the case that the aspect instance does not express an instance-specific order through implementing the Ordered interface.

      The default implementation simply returns Ordered.LOWEST_PRECEDENCE.

      Parameters:
      aspectClass - the aspect class