Retain annotations on CGLIB proxies?

后端 未结 4 1281
抹茶落季
抹茶落季 2020-12-06 00:44

Am trying to create an object using an AOP framework which uses CGLIB to create proxy objects. Strangely enough, the \"enhanced\" proxy object is devoid of ANY annotations t

4条回答
  •  我在风中等你
    2020-12-06 01:10

    This isn't an issue with "retaining" the annotations. CGLIB proxies are actually generated subclasses of the target object's class. These subclasses may not have annotations, but their superclass (i.e. your own class) will still have them. Any annotation-reflecting code you use needs to be able to look back up the class hierarchy to look for annotations.

提交回复
热议问题