[jboss-dev-forums] [Design of POJO Server] - Pushing correct aspect manager for a deployment
kabir.khan@jboss.com
do-not-reply at jboss.com
Mon Aug 4 10:53:59 EDT 2008
I am working on an edge case for deploying aop in AS using aop-mc-int. I have a deployment1 using default classloading:
| <deployment xmlns="urn:jboss:bean-deployer:2.0">
|
| <bean name="GlobalDependency" class="org.jboss.test.aop.scopeddependency.GlobalDependency"/>
|
| </deployment>
|
and a deployment2 using a scoped classloader
| <deployment xmlns="urn:jboss:bean-deployer:2.0">
|
| <interceptor xmlns="urn:jboss:aop-beans:1.0"
| name="ScopedInterceptor"
| class="org.jboss.test.aop.scopeddependency.ScopedInterceptor"
| manager-bean="AspectManager"
| manager-property="aspectManager">
| <property name="scopedDependency"><inject bean="ScopedDependency"/></property>
| </interceptor>
|
| <bind xmlns="urn:jboss:aop-beans:1.0"
| pointcut="execution(* org.jboss.test.aop.scopeddependency.ScopedTester->*(..))"
| manager-bean="AspectManager"
| manager-property="aspectManager">
| <interceptor-ref name="ScopedInterceptor"/>
| </bind>
|
| <bean name="ScopedTester" class="org.jboss.test.aop.scopeddependency.ScopedTester"/>
|
| </deployment>
|
ScopedTester is incorrectly deployed since the dependencies are not picked up. The problem seems to be that AOPDependencyBuilder calls AspectManager.instance() which uses TCL to determine the scoped aspect domain to use, however in the DESCRIBE phase this classloader has not been set yet, and so the top-level AspectManager which does not contain the bindings deployed to the scoped aspect domain is used. My deployer has created the scoped aspect domain at this stage, but I need some nice way to make it available to AOPDependencyBuilder. I could push it onto a ThreadLocal, but that might be a bit hacky. What would be nice would be to be able to add it to the bean's MetaData, but as far as I can tell I have no control/access to that, I think the bean's MetaData is created by the BeanMetaDataDeployer? If such a thing exisits, is adding it to the deployments metadata an option? How do I do that?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4168481#4168481
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4168481
More information about the jboss-dev-forums
mailing list