Ask Questions & Get Answers at ibibo sawaal

ayisha's Questions & Answers

52

Rank

22587

4569

33

50

What are important ApplicationContext implementations in spring framework?

Asked by Amit Dubey in Computers & Technology at   10:06 PM on December 08, 2008

ayisha's Answer

Important ApplicationContext implementations in spring framework are
1)ClassPathXmlApplicationConte xt – This context loads a context definition from an XML file located in the class path, treating context definition files as class path resources.
2)FileSystemXmlApplicationContext – This context loads a context definition from an XML file in the filesystem.
3)XmlWebApplicationContext – This context loads the context definitions from an XML file contained within a web application.

Answered at 11:42 PM on December 08, 2008

Read all answers

Explain Bean lifecycle in Spring framework?

Asked by Amit Dubey in Computers & Technology at   10:07 PM on December 08, 2008

ayisha's Answer

1. The spring container finds the bean’s definition from the XML file and instantiates the bean.

2. Using the dependency injection, spring populates all of the properties as specified in the bean definition.

3. If the bean implements the BeanNameAware interface, the factory calls setBeanName() passing the bean’s ID.

4. If the bean implements the BeanFactoryAware interface, the factory calls setBeanFactory(), passing an instance of itself.

5. If there are any BeanPostProcessors associated with the bean, their post- ProcessBeforeInitialization() methods will be called.

6. If an init-method is specified for the bean, it will be called.

7. Finally, if there are any BeanPostProcessors associated with the bean, their postProcessAfterInitialization() methods will be called.
Sources:
http://faqs.javabeat.ne t/spring/spring-interview-questions -faqs-2.php..

Answered at 11:40 PM on December 08, 2008

Read all answers

How do add a bean in spring application?

Asked by Amit Dubey in Computers & Technology at   10:07 PM on December 08, 2008

ayisha's Answer

<?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.
sources:
http://faqs.javabeat.ne t/spring/spring-interview-questions -faqs-2.php

Answered at 11:39 PM on December 08, 2008

Read all answers

What is bean wiring?

Asked by Amit Dubey in Computers & Technology at   10:07 PM on December 08, 2008

ayisha's Answer

Combining together beans within the Spring container is known as bean wiring or wiring. When wiring beans, you should tell the container what beans are needed and how the container should use dependency injection to tie them together.
Sources:
http://faqs.javabeat.ne t/spring/spring-interview-questions -faqs-2.php..

Answered at 11:40 PM on December 08, 2008

Read all answers

What are the important beans lifecycle methods?

Asked by Amit Dubey in Computers & Technology at   10:10 PM on December 08, 2008

ayisha's Answer

There are two important bean lifecycle methods. The first one is setup which is called when the bean is loaded in to the container. The second method is the teardown method which is called when the bean is unloaded from the container.
Sources:
http://faqs.javabeat.ne t/spring/spring-interview-questions -faqs-3.php..

Answered at 11:37 PM on December 08, 2008

Read all answers

What are singleton beans and how can you create prototype beans? ?

Asked by Amit Dubey in Computers & Technology at   10:09 PM on December 08, 2008

ayisha's Answer

Beans defined in spring framework are singleton beans. There is an attribute in bean tag named ‘singleton’ if specified true then bean becomes singleton and if set to false then the bean becomes a prototype bean. By default it is set to true. So, all the beans in spring framework are by default singleton beans.
Sources:
http://faqs.javabeat.ne t/spring/spring-interview-questions -faqs-3.php

Answered at 11:38 PM on December 08, 2008

Read all answers

What are Inner Beans?

Asked by Amit Dubey in Computers & Technology at   10:10 PM on December 08, 2008

ayisha's Answer

When wiring beans, if a bean element is embedded to a property tag directly, then that bean is said to the Inner Bean. The drawback of this bean is that it cannot be reused anywhere else.
Sources:
http://faqs.javabeat.ne t/spring/spring-interview-questions -faqs-3.php

Answered at 11:34 PM on December 08, 2008

Read all answers

What is Auto wiring?

Asked by Amit Dubey in Computers & Technology at   10:10 PM on December 08, 2008

ayisha's Answer

You can wire the beans as you wish. But spring framework also does this work for you. It can auto wire the related beans together. All you have to do is just set the autowire attribute of bean tag to an autowire type.
<beans>
<bean id="bar" class="com.act.Foo" Autowire=”autowire type”/>
</beans>

Answered at 11:29 PM on December 08, 2008

Read all answers

How can you override beans default lifecycle methods?

Asked by Amit Dubey in Computers & Technology at   10:10 PM on December 08, 2008

ayisha's Answer

The bean tag has two more important attributes with which you can define your own custom initialization and destroy methods. Here I have shown a small demonstration. Two new methods fooSetup and fooTeardown are to be added to your Foo class.

<beans>

<bean id="bar" class="com.act.Foo" init-method=”fooSetup” destroy=”fooTeardown”/>

</beans>
Sources:
http://faqs.javabeat.net/ spring/spring-interview-questions-f aqs-3.php..

Answered at 11:36 PM on December 08, 2008

Read all answers

What are the different types of bean injections?

Asked by Amit Dubey in Computers & Technology at   10:10 PM on December 08, 2008

ayisha's Answer

Hi Amit .There are two types of bean injections.
1)By setter
2)By constructor....

Answered at 11:31 PM on December 08, 2008

Read all answers

Editor's Pick

Categories

sawaal signature
sawaal free visiting card