[jboss-dev-forums] [Design the new POJO MicroContainer] - Should @Inject find an alias?

scott.stark@jboss.org do-not-reply at jboss.com
Thu Oct 16 13:15:48 EDT 2008


I'm seeing a failure to inject a bean by its alias. Given this bean:


  |     <!-- An InitialContextFactory that uses the NamingContext.getLocal() Naming -->
  |     <bean name="InitialContextFactory#1" class="org.jboss.naming.InitialContextFactoryBean">
  |         <alias>InitialContextFactory</alias>
  |         <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.jnp.interfaces.LocalOnlyContextFactory</value>
  |                 </entry>
  |                 <entry>
  |                     <key>java.naming.factory.url</key>
  |                     <value>org.jboss.naming:org.jnp.interfaces</value>
  |                 </entry>
  |             </map>
  |         </property>
  |         <depends>testLocaNamingBeanImpl#1</depends>
  |     </bean>
  | 

This injection into a unit test:

  |    @Inject(bean="InitialContextFactory", property="ctx")
  |    public void setInitialContext(InitialContext ctx)
  |    {
  |       this.ctx = ctx;
  |    }
  | 

fails with:

  | java.lang.IllegalStateException: Incompletely deployed:
  | 
  | *** DEPLOYMENTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}
  | b4fb6399-bd84-41be-a3bc-4a0ddc0da8e6 -> InitialContextFactory{Installed:** NOT FOUND **}
  | 
  | 	at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.internalValidate(AbstractKernelDeployer.java:290)
  | 	at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.validate(AbstractKernelDeployer.java:174)
  | 	at org.jboss.test.kernel.junit.MicrocontainerTestDelegate.validate(MicrocontainerTestDelegate.java:262)
  | 	at org.jboss.test.kernel.junit.MicrocontainerTest.afterSetUp(MicrocontainerTest.java:117)
  | 	at org.jboss.test.kernel.junit.MicrocontainerTest.setUp(MicrocontainerTest.java:91)
  | 


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

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



More information about the jboss-dev-forums mailing list