Announcement Announcement Module
Collapse
No announcement yet.
Advised classes loose their @annotations? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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?

  • #2
    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).

    Comment

    Working...
    X