Announcement Announcement Module
Collapse
No announcement yet.
Nested Aspect (Spring AOP) not being injected properly Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Nested Aspect (Spring AOP) not being injected properly

    Please note: I'm not sure if this belongs in the AOP forum, or the Core forum. I will move if this isn't the right place.

    Some background information - I have two projects, some common code, and a web application. The web application depends on the common code; all tied together using Maven. I have an Aspect in the common code (using annotations, not XML config) that has an @Autowired field. In the web application, I have another aspect (again annotated with @Aspect) that has its own @Autowired field. At runtime, I see both aspects being instantiated:

    The web-app aspect:
    Code:
    2009-02-19 11:02:38 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'gtechLoggingAspect'
    2009-02-19 11:02:38 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'gtechLoggingAspect'
    2009-02-19 11:02:38 DEBUG [org.springframework.beans.factory.annotation.InjectionMetadata] Found injected field on class [com.cryptologic.bsg.aspect.GtechLoggingAspect]: AutowiredFieldElement for private com.cryptologic.common.jpa.GenericDao com.cryptologic.bsg.aspect.GtechLoggingAspect.gd
    2009-02-19 11:02:38 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'gtechLoggingAspect' to allow for resolving potential circular references
    2009-02-19 11:02:38 DEBUG [org.springframework.beans.factory.annotation.InjectionMetadata] Processing injected field of bean 'gtechLoggingAspect': AutowiredFieldElement for private com.cryptologic.common.jpa.GenericDao com.cryptologic.bsg.aspect.GtechLoggingAspect.gd
    2009-02-19 11:02:38 DEBUG [org.springframework.aop.aspectj.annotation.ReflectiveAspectJAdvisorFactory] Found AspectJ method: public java.lang.Object com.cryptologic.bsg.aspect.GtechLoggingAspect.processLogin(org.aspectj.lang.ProceedingJoinPoint,com.cryptologic.bsg.model.UserLoginUserinfoRequest) throws java.lang.Throwable
    2009-02-19 11:03:47 DEBUG [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor] Autowiring by type from bean name 'gtechLoggingAspect' to bean named 'genericDaoImpl'
    2009-02-19 11:03:47 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'gtechLoggingAspect'
    The common code aspect:
    Code:
    2009-02-19 11:03:47 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'ecashProviderAspect'
    2009-02-19 11:03:47 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'ecashProviderAspect'
    2009-02-19 11:03:47 DEBUG [org.springframework.beans.factory.annotation.InjectionMetadata] Found injected field on class [com.cryptologic.bsg.aspect.EcashProviderAspect]: AutowiredFieldElement for private com.cryptologic.common.jpa.GenericDao com.cryptologic.bsg.aspect.EcashProviderAspect.gd
    2009-02-19 11:03:47 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'ecashProviderAspect' to allow for resolving potential circular references
    2009-02-19 11:03:47 DEBUG [org.springframework.beans.factory.annotation.InjectionMetadata] Processing injected field of bean 'ecashProviderAspect': AutowiredFieldElement for private com.cryptologic.common.jpa.GenericDao com.cryptologic.bsg.aspect.EcashProviderAspect.gd
    2009-02-19 11:03:47 DEBUG [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor] Autowiring by type from bean name 'ecashProviderAspect' to bean named 'genericDaoImpl'
    2009-02-19 11:03:47 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'ecashProviderAspect'

    Now, at runtime, the aspects are supposed to log certain information into the database. The web app apsect works fine, but the @Autowired field in the common aspect is null. Any ideas as to why, or what is going on?

    Edit:
    I missed a portion of the logs, both aspects are being created in the same fashion, but I don't see a "Found AspectJ method" message for the common code aspect.

    Edit 2:
    Before the web-app aspect is invoked, I see the following in the logs:
    Code:
    2009-02-19 11:44:00 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'gtechLoggingAspect'
    I do not see it for the common code aspect.

    Edit 3:
    This apparently only happens when using MyEclipse to deploy to WebLogic 9.2; if I use Maven to build the EAR and manually deploy it, everything works as expected. So, some sort of classloader issue?
    Last edited by mlaccetti; Feb 19th, 2009, 02:34 PM.
Working...
X