[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: MDR doesn't work on annotated privates

adrian@jboss.org do-not-reply at jboss.com
Wed Aug 13 11:05:07 EDT 2008


"wolfc" wrote : anonymous wrote : 
  |   | My concern would be whether AOP needs to also use annotations on the
  |   | method during the invocation and so know to use this Signature?
  | Not right now, because the EJB3 container sets up a manual interceptor chain. In future this chain should also come from aop.xml, then it might become a problem.
  | 
  | Note that both web container & client container have so far been left out of scope.
  | 

That's not what I meant. If the method is enhanced using an AOP aspect,
it may want access to the annotations, e.g.


  | @PostConstruct
  | @LogCalls(level=Leves.TRACE)
  | private void postConstruct() {}
  | 
  | @Aspect
  | public CallLogging
  | {
  |    public Object invoke(MethodInvocation invocation) throws Throwable
  |     {
  |         // This effectively does 
  |         // advisor.getMetaData().getComponentMetaData(new MethodSignature(invocation.getMethod())).getAnnotation(LogCalls.class)
  |         LogCalls logCalls = invocation.getAnnotation(LogCalls.class);
  | 
  |         // Impl
  |         doLog(logCalls, invocation);
  |     }
  | }
  | 

Which would kind of work as it currently stands (since it doesn't validate the method).

The "kind of" is because it is not intended to work, and wouldn't work
if you don't use the constructor with the Method in it.

If you don't pass the Method object, it has to search for the Method
and will instead find the one in Sub.class.

Is there a Jira for the new method signature?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4170354#4170354

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4170354



More information about the jboss-dev-forums mailing list