Explain how to add a bean in spring application

Ask a question
          

Interview questions

How to add a bean in spring application

<<Previous Next>> 
Spring - Explain how to add a bean in spring application. - Feb 24, 2009, 19:00 pm by Vidya Sagar

Explain how to add a bean in spring application.

The id attribute of the bean tag specifies the name of the bean and the fully qualified class name is specified by the class attribute. The following is the fragment of the XML file of spring which illustrates the bean and class attributes.

<bean>
<bean id=”bar” class=”com.act.SomeAction” singleton=”false”/>
</bean> 

Spring - Explain how to add a bean in spring application. - Nov 11, 2009, 18:10 pm by Amit Satpute

Explain how to add a bean in spring application.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
        <bean id="foo" class="com.act.Foo"/>     
        <bean id="bar" class="com.act.Bar"/>
</beans>

In the bean tag the id attribute specifies the bean name and the class attribute specifies the fully qualified class name.

<<Previous Next>>  



Write your comment - Share Knowledge and Experience


 

 
Latest placement tests
Latest links
 
 
Home | Login | About us | Sitemap | Contact us