• Post Reply Bookmark Topic Watch Topic
  • New Topic

error being thrown at each element in applicationcontext.xml (Springs)  RSS feed

 
mvPrasad Regula
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an applicationcontext.xml which looks as below. It is throwing an error at each line
1. Element map is not allowed here
2. cannot resolve symbol entry
3. cannot resolve symbol bean
4. cannot resolve symbol property
...
...


<bean id="sampleLookupServices" class="com.springweb.ch3.MapCustomerLookupService">

<map>
<entry key="a1234">
<bean class="com.springweb.ch3.Customer">
<property name="customerID" value="a1234"/>
<property name="firstName" value="Rod"/>
<property name="lastName" value="Johnson"/>
<property name="balance" value="123.45"/>
</bean>
</entry>
<entry key="a1235">
<bean class="com.springweb.ch3.Customer">
<property name="customerID" value="a1235"/>
<property name="firstName" value="Julia"/>
<property name="lastName" value="Roberts"/>
<property name="balance" value="123.45"/>
</bean>
</entry>
<entry key="a1236">
<bean class="com.springweb.ch3.Customer">
<property name="customerID" value="a1236"/>
<property name="firstName" value="Alan"/>
<property name="lastName" value="Springer"/>
<property name="balance" value="123.45"/>
</bean>
</entry>
</map>

</bean>
 
mvPrasad Regula
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me post the full file

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="shape1" class="coreservlets.Rectangle">
<property name="length" value="10"/>
<property name="width" value="20"/>
</bean>
<bean id="shape2" class="coreservlets.Circle">
<constructor-arg value="10"/>
</bean>

<bean id="colorPreferences" class="com.springweb.ch3.ColorPreferences" scope="request" >
<property name="background" value="#fdf5e6"/>
<property name="foreground" value="black"/>
</bean>

<bean id="sampleLookupServices" class="com.springweb.ch3.MapCustomerLookupService">

<map>
<entry key="a1234">
<bean class="com.springweb.ch3.Customer">
<property name="customerID" value="a1234"/>
<property name="firstName" value="Rod"/>
<property name="lastName" value="Johnson"/>
<property name="balance" value="123.45"/>
</bean>
</entry>
<entry key="a1235">
<bean class="com.springweb.ch3.Customer">
<property name="customerID" value="a1235"/>
<property name="firstName" value="Julia"/>
<property name="lastName" value="Roberts"/>
<property name="balance" value="123.45"/>
</bean>
</entry>
<entry key="a1236">
<bean class="com.springweb.ch3.Customer">
<property name="customerID" value="a1236"/>
<property name="firstName" value="Alan"/>
<property name="lastName" value="Springer"/>
<property name="balance" value="123.45"/>
</bean>
</entry>
</map>

</bean>
</beans>
 
mvPrasad Regula
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
got the answer. These map elements are to be placed between property elements as below
<property name="xxx">
<map>...</map>
</property>
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!