[jboss-dev-forums] [Design the new POJO MicroContainer] - Added JndiBinding aspect/annotation
scott.stark@jboss.org
do-not-reply at jboss.com
Fri Nov 10 05:47:30 EST 2006
I added org.jboss.aop.microcontainer.aspects.jndi.JndiIntroduction and a org.jboss.aop.microcontainer.aspects.jndi.JndiBinding annotation to support binding a bean into jndi on the KernelControllerContextAware callbacks.
| /**
| * An annotation that indicates an object should be bound into JNDI
| *
| * @author Scott.Stark at jboss.org
| * @version $Revision: 46386 $
| */
| @Retention(RetentionPolicy.RUNTIME)
| @Target({ElementType.TYPE,ElementType.FIELD})
| public @interface JndiBinding
| {
| /**
| * the name under which the binding will be located
| * @return
| */
| String name() ;
| /**
| * Optional additional aliases to also bind
| * @return
| */
| String[] aliases() default {};
| }
|
| <deployment xmlns="urn:jboss:bean-deployer:2.0">
| ...
| <!-- Define the jndi binding advice -->
| <beanfactory name="JndiAdvice" class="org.jboss.aop.microcontainer.aspects.jndi.JndiIntroduction">
| <!-- The IntialContext ctor env to use -->
| <property name="env">
| <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
| <entry><key>java.naming.factory.initial</key><value>org.jboss.test.microcontainer.support.jndi.MockInitialContextFactory</value></entry>
| </map>
| </property>
| </beanfactory>
|
| ...
|
See the org.jboss.test.microcontainer.test.JndiDecoratedTestCase and /aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/JndiDecoratedTestCase.xml for an example.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984848#3984848
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984848
More information about the jboss-dev-forums
mailing list