[jboss-dev-forums] [Design the new POJO MicroContainer] - AOPConstructorJoinpoint::methodHasAnnotations is wrong
alesj
do-not-reply at jboss.com
Tue Apr 1 07:00:59 EDT 2008
When doing a check if current underlying context needs to be instantiated as an AOP proxy, we were looking in both cases - class and methods - if there is an INSTANCE scope metadata present.
But in case I have this, adding annotations to property:
| <bean name="Bean6" class="org.jboss.test.microcontainer.support.SimpleBeanImpl">
| <property name="property">
| <annotation>@org.jboss.test.microcontainer.support.SomeNonIA</annotation>
| <annotation>@org.jboss.test.microcontainer.support.ContainsIA</annotation>
| <value>123</value>
| </property>
| </bean>
|
this is called - a place where this xml annotations get put into metadata:
KernelScopeInfo
| /**
| * Add annotations for a method
| *
| * @param classloader the classloader
| * @param mutable the mutable metadata
| * @param methodInfo the method info
| * @param annotations the annotations
| */
| private void addAnnotations(ClassLoader classloader, MemoryMetaDataLoader mutable, MethodInfo methodInfo, Set<AnnotationMetaData> annotations)
| {
| ScopeKey scope = new ScopeKey(CommonLevels.JOINPOINT_OVERRIDE, methodInfo.getName());
| MemoryMetaDataLoader loader = new MemoryMetaDataLoader(scope);
| addAnnotations(classloader, loader, annotations);
| mutable.addComponentMetaDataRetrieval(new MethodSignature(methodInfo), loader);
| }
|
Property annotations are added to JOINPOINT_OVERRIDE level, not to INSTANCE.
So, this really never worked in AOPConstructorJoinpoint - to get a proxy for beans that have annotations added to methods via xml.
Whether property annotations are put to the wrong place, or we are doing a wrong level lookup. I suspect the other. :-)
I'll fix code to use JOINPOINT_OVERRIDE level when checking whether methods have 'instance' metadata.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4140406#4140406
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4140406
More information about the jboss-dev-forums
mailing list