Manish
Manish

Reputation: 19

Invalid element name: - property One of the following is expected: - import - alias - bean - WC[##other:"http://www.springframework.org/schema/beans"]

    <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:p="http://www.springframework.org/schema/p"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context.xsd">

    <bean name="employee" class="com.bharath.spring.springcore.innerbeans.Employee" p:id="123"/>
    
    <property name="address">
    <bean class="com.bharath.spring.springcore.innerbeans.Address" p:hno="700" p:street="BANK MORE" p:city="DHANBAD"/>
    
    
    </property>
    
</beans>

getting the error mentioned in the question heading line. below is the error

Invalid element name: - property One of the following is expected: - import - alias - bean - WC[##other:"http://www.springframework.org/schema/beans"] - beans Error indicated by: {http://www.springframework.org/schema/beans} with code:

Upvotes: 1

Views: 1344

Answers (1)

Raul Lapeira Herrero
Raul Lapeira Herrero

Reputation: 987

Property must be a child element of bean

 <bean name="employee" class="com.bharath.spring.springcore.innerbeans.Employee" p:id="123">
    <property name="address">
</bean>

Upvotes: 0

Related Questions