JavaBeat FAQs
FAVORITES
Download a movie FAQ
JAVABEAT
Home
Articles
Tips
QnA
Forums
FAQs Topics Books Topic
Java Java Books
Struts Struts Books
Spring Spring Books
Hibernate Hibernate Books
JBoss Seam Seam Books
J2EE J2EE Books
EJB EJB Books
JSF JSF Books
Servlets Servlets Books
JDBC JDBC Books
RMI RMI Books
JMS JMS Books
JNI JNI Books
Design Patterns Patterns Books
Exception Exception Books
Apache Ant Ant Books
Groovy
Cobertura
Quartz
1000 Interview Questions on Java / J2EE technologies. Buy now for JUST 12.99 USD or 400 INR. Send us mail to sales@javabeat.net

Spring Framework Interview Questions

Spring Framework is a lightweight container, with wrappers that make it easy to use many different services and frameworks. Lightweight containers accept any JavaBean, instead of specific types of components."Spring is more than just a 'lightweight container,'" says Justin Gehtland. "It allows Java developers who are building J2EE apps to get to the heart of their real domain problems and stop spending so much time on the minutiae of providing services to their domain." Gehtland and Bruce Tate are coauthors of Spring: A Developer's Notebook, a no-nonsense book that will get you up to speed quickly on the new Spring open source framework. Spring: A Developer's Notebook includes examples and practical applications that demonstrate exactly how to use Spring, in ten chapters of code-intensive labs.

Spring Articles

Introduction to Spring Web Framework

Introduction to Spring's Aspect Oriented Programming(AOP)

Spring Web Flow - Introduction

Introduction to Spring IDE 2.0

Introduction to Spring MVC Web Framework - Web Tier

 
Spring FAQs - 1 | Spring FAQs - 2 | Spring FAQs - 3 | Spring FAQs - 4 | Spring FAQs - 5
  1. What are singleton beans and how can you create prototype beans?

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.

<beans>

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

</beans>

  1. What are the important beans lifecycle methods?

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.


  1. How can you override beans default lifecycle methods?

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>

  1. What are Inner Beans?

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.


  1. What are the different types of bean injections?

There are two types of bean injections.

    1. By setter

    2. By constructor


  1. What is Auto wiring?

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>


  1. What are different types of Autowire types?

There are four different types by which autowiring can be done.

    • byName

    • byType

    • constructor

    • autodetect


  1. What are the different types of events related to Listeners?

There are a lot of events related to ApplicationContext of spring framework. All the events are subclasses of org.springframework.context.Application-Event. They are

  • ContextClosedEvent – This is fired when the context is closed.

  • ContextRefreshedEvent – This is fired when the context is initialized or refreshed.

  • RequestHandledEvent – This is fired when the web context handles any request.


  1. What is an Aspect?

An aspect is the cross-cutting functionality that you are implementing. It is the aspect of your application you are modularizing. An example of an aspect is logging. Logging is something that is required throughout an application. However, because applications tend to be broken down into layers based on functionality, reusing a logging module through inheritance does not make sense. However, you can create a logging aspect and apply it throughout your application using AOP.


  1. What is a Jointpoint?

A joinpoint is a point in the execution of the application where an aspect can be plugged in. This point could be a method being called, an exception being thrown, or even a field being modified. These are the points where your aspect’s code can be inserted into the normal flow of your application to add new behavior.


Related Articles
JAX-WS Web Services in NetBeans 6.1
JPA in NetBeans 6.1
EJB 3.0 and WebServices
Types of Managed Bean scopes in Spring Framework
OpenCms 7 Development
Liferay Portal Enterprise Intranets
ZK Developer’s Guide : Online Media Library
The BIRT Environment and Your First Report
AJAX - The Complete Reference
The Java 6.0 Compiler API
more articles
java6 ejb3 jsf hibernate eclipse ajax groovy spring seam java struts webservice j2me guice java5 jca tapestry soa linux ria books

Favorites
C# problem error
Java News
AffiliatedAds.com
Access Control
Busby seo challenge contest
Sohbet
Chat
Webmaster Hosting Forum
Java Jobs
MyVideoLib
Sohbet
chat
Latest QnA
SCJD Tips
When we start a thread by applying start() method on it ,how does it knows that to execute run()method?
About Wrapper class in Java
How to configure weblogic 7.0 in MyEclipse?
Static Block and Static Initializer in Java

JavaBeat Website (2004-2008), India
javabeat | planetoss | about us | write for us | useful resources
Copyright (2004 - 2008), JavaBeat