Bean configuration in Spring

I have two beans configured in spring following way. I am giving the pseudo code as below

 <beans>    <bean id="a" class="Employee">    <property name="b">    <bean id="b" class="Department">     <property name="a">  </beans> 

What happens in this case. I think the configuration works fine. Correct me if i am wrong.

I would like to know if i can configure beans in such a way. If it not proper then what exception it throws

Replay

You lack a closing quote on Employee class. Also, use a ref attribute to attach another bean to a bean's property. Here's the fix:

<beans>
   <bean id="a" class="Employee">
   <property name="b" ref="b">
   <bean id="b" class="Department">
    <property name="a" ref="a">
 </beans>

Category: java Time: 2016-07-31 Views: 20
Tags: java spring

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.426 (s). 13 q(s)