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

wolfc do-not-reply at jboss.com
Wed Aug 13 08:10:54 EDT 2008


"adrian at jboss.org" wrote : Why a new signature? The idea of the MetaData is that it should be able to
  | load relevant metadata and the caller doesn't have to think too hard.
  | 
  | If we are going to support I'd prefer to have something like:
  | 
  | 
  |   | <bean name="MetaDataRepository" ...>
  |   |    <property name="joinpointInheritableAnnotations">
  |   |       <set class="java.lang.Class">
  |   |          <value>javax.ejb.PostConstruct</value>
  |   |       </set>
  |   |  ...
  |   | 
  | 
  | Then it would be configuratble which annotations you need to do
  | the wangy search (no suprises or extra work for other annotations)
  | and it would be transparent to the user of MetaData.
Doesn't this contradict the example you're about to give?
There the Sub.postConstruct override doesn't have the annotation, but if it's inheritable it would get one.

That's not what I want.
"adrian at jboss.org" wrote : Incidently, I think this semantic is broken, since it means you cannot
  | override the annotations of the super class. Not very OOPS. :-)
  | 
  | 
  |   | public Sub extends Super
  |   | {
  |   |    @Override
  |   |    // No annotations here
  |   |    public void postConstruct() {}
  |   | 
  |   |    // This is my postConstruct method
  |   |    @PostConstruct
  |   |    public void myPostConstruct() {}
  |   | }
  |   | 
Yes you can, see EJB 3 12.4.1 the last bullet.

It's just that if there is a private method with a @PostConstruct it must be invoked regardless of the sub class (which is the weird part).

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

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



More information about the jboss-dev-forums mailing list