"ron.sigal(a)jboss.com" wrote :
| bstansberry(a)jboss.com" wrote :
| | If the "factory" element supported a nested "bean" element it
would be a bit cleaner.
| |
|
| Just to be sure I understand, you're talking about a microcontainer feature,
right, not something I should do with RemotingProxyFactory?
Yep. Just a minor thing. Instead of this:
| <bean name="SampleTargetProxyFactory"
class="org.jboss.aspects.remoting.RemotingProxyFactory">
|
| ......
|
| </bean>
|
| <bean
class="org.jboss.aspects.remoting.test.proxy.SampleInterface1">
|
| <annotation>
|
@org.jboss.aop.microcontainer.aspects.jndi.JndiBinding(name="proxyTestJNDI")
| </annotation>
|
| <constructor factoryMethod="getProxy">
| <factory bean="SampleTargetProxyFactory"/>
| </constructor>
|
| </bean>
|
You'd nest the factory bean:
| <bean
class="org.jboss.aspects.remoting.test.proxy.SampleInterface1">
|
| <annotation>
|
@org.jboss.aop.microcontainer.aspects.jndi.JndiBinding(name="proxyTestJNDI")
| </annotation>
|
| <constructor factoryMethod="getProxy">
| <factory>
| <bean
class="org.jboss.aspects.remoting.RemotingProxyFactory">
|
| ......
|
| </bean>
| </factory>
| </constructor>
|
| </bean>
|
The nesting just reduces the visibility of the factory vs. the proxy, plus saves having to
name the factory bean.
"ron.sigal(a)jboss.com" wrote :
| I think the use of the factory element here is also pretty cool. The one thing that
strikes me is that the bean with the factory element is defined with a single interface
class, even though the proxy will, in fact, implement two interfaces. I certainly
don't know the microcontainer internals, but superficially it seems like a bean with a
factory element could live without a class attribute, since it could be derived from the
factory method's return type.
The class attribute is optional in the schema; I don't know if omitting it would work.
I believe in the past it was required, but the MC guys are improving stuff all the time.
You could also use org.jboss.aop.proxy.Proxy instead of the interface. In fact you might
have to, since that's the return type from the factory method. I used the interface
because that's the idiom I'd used previously with a factory bean for creating a
JBoss Cache instance. But the return type on their factory was the interface
org.jboss.cache.Cache.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4166541#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...