Saturday 15 August 2015

javabeans - Accessing spring bean using context.lookup()? -


I am new to spring and am trying to reach bean with my code. Bean: & lt; Beans & gt; & Lt; Bean id = "bnid" class = "org.apache.xbean.spring.jndi.DefaultContext" & gt; & Lt; Property Name = "Entries" & gt; & Lt; Map & gt; & Lt; Entry key = "Dummy" value = "DummyWell" & gt; & Lt; Map & gt; & Lt; Entry key = "Mikey" & gt; & Lt; / Entry & gt; & Lt; / Map & gt; & Lt; / Entry & gt; & Lt; / Map & gt; & Lt; / Property & gt; ........

I want to use the "dummyval" value. When I use this code snippet, I give a map inside the Dummy insertion, but I'm not sure how to see the "DummyWall" value.

  objBean = context.lookup ("damick");    

A map entry contains a key and a value. You are trying two values ​​in the same entry (the map defined as Dummville and sub-element of the entry). It does not understand, and seems to use the spring sub-element and to ignore the value attribute.

No comments:

Post a Comment