Why is it showing Element type "bean" must be followed by either attribute specifications, ">" or "/ >".at <property name="list">

      <?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-3.0.xsd">

        <bean id="SampleWorld" class="com.spring.collections"

1. This is the point i get the Element type "bean" must be followed by either attribute specifications, ">" or "/>".

            <property name="list">
                <list>
                    <value> 1 </value>
                </list>
                <ref = employee " />
            </property>

            <property name="set">
                <set>
                    <value> 21</value>
                </set>
                <ref = employee " />
            </property>

            <property name="properties">
                <properties>
                    <value> 21</value>
                </properties>
                <ref = employee " />
            </property>
            <property name="map">
                <map>
                    <entry key="1" value="value1" />
                    <entry key="2" value-ref="employee" />
                </map>
            </property>
        </bean>

2. THis is another dependency bean class to inject id and employee dependencies.

        <bean id="employee" class="com.spring.collections"


            <property name="id" value="2312" />
            <property name="employeeName" value="SpringHero" />
        </bean>
    </beans>
Jon Skeet
people
quotationmark

You have to finish the opening tag of the element before you have any nested content (other elements, or text). In XML, this is fine:

<x>
  <y />
</x>

But this isn't:

<x
  <y />
</x>

This isn't Spring-specific or Java-specific - you've got plain invalid XML at the moment. The only things that can be within an opening tag are attributes.

people

See more on this question at Stackoverflow