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>
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.