Results 1 to 2 of 2

Thread: Advised classes loose their @annotations?

  1. #1
    Join Date
    Aug 2004
    Posts
    230

    Default Advised classes loose their @annotations?

    I am advising a class with an introduction. That class contains @annotated methods. The subclass created by cglib adds the introduction correctly, but all the annotations on the methods from the advised class are lost. All the annotations have @Inhertited declared.

    Is this a known issue with cglib subclasses?
    Barry Kaplan (memelet)

  2. #2
    Join Date
    Aug 2004
    Posts
    230

    Default

    Since I have beans that are being advised and also exported as mbeans -- and that works -- I decided to look at AbstractMBeanInfoAssembler. Appearently, it makes an explicit check to see if the class has cglib-proxied:

    Code:
    	protected Class getClassToExpose(Object managedBean) {
    		if (AopUtils.isCglibProxy(managedBean)) {
    			return managedBean.getClass().getSuperclass();
    		}
    		return managedBean.getClass();
    	}
    But I'm still not sure if the reason was because the method annotations are stripped from the cglib-proxied subclass. If so, I'm in trouble, because the method I'm trying to introduce defines an annotation that needs to processed at runtime. Therefore I cannot simply upcast like the snippet above (ie, I need to see the methods on the subclass as well).
    Barry Kaplan (memelet)

Similar Threads

  1. PerformanceMonitorInceptor
    By chenrici in forum AOP
    Replies: 15
    Last Post: May 18th, 2006, 04:28 PM
  2. AopCoinfigException is normal?
    By Donald in forum AOP
    Replies: 2
    Last Post: Sep 28th, 2005, 09:12 AM
  3. PerformanceMonitorInterceptor
    By tnist in forum AOP
    Replies: 3
    Last Post: Aug 24th, 2005, 01:39 PM
  4. Replies: 1
    Last Post: May 28th, 2005, 06:28 AM
  5. Command classes and actions
    By stevecnz in forum Web
    Replies: 1
    Last Post: Oct 6th, 2004, 05:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •