Explain how to add a bean in spring application

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.

What are singleton beans and how can you create prototype beans?
Singleton beans and prototype beans - All beans defined in the spring framework are singleton beans. The bean tag has an attribute by name ‘singleton’.....
What is Auto wiring? What are different types of Autowire?
What is Auto wiring? - Searching for objects with the same name of object property is called auto wiring in Spring..
What is meant by Weaving? Different points where weaving can be applied
What is meant by Weaving? - The process of applying aspects to a target object for creating a new proxy object is referred to as weaving...
Post your comment