Monday, September 7, 2009

SPRING interview Questions

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>

What is AbstractCommandController?

A command controller used to create your own command controller, capable of binding request parameters to a data object you specify. This class offer validation features and specify the controller itself what to do with the command object that has been filled with the parameters from the request.

What is AbstractFormController?

An abstract controller offering form submission support. This controller helps in modeling forms and populates them using a command object you retrieve in the controller. After filling the form, the AbstractFormController binds the fields, validates, and hands the object back to the controller to take appropriate action. Some More features are: invalid form submission (resubmission), validation, and normal form workflow. You implement methods to determine which views are used for form presentation and success. Use this controller if you need forms, but don't want to specify what views you're going to show the user in the application context.

What is SimpleFormController?

A concrete FormController that provides excellent support when creating a form with a corresponding command object. The SimpleFormController let's you specify a command object, a viewname for the form, a viewname for page you want to show the user when form submission has succeeded.

What are different types of Autowire types?

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

  1. By Name
  2. byType
  3. constructor
  4. autodetect

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

  1. ContextClosedEvent This is fired when the context is closed.
  2. ContextRefreshedEvent This is fired when the context is initialized or refreshed.
  3. RequestHandledEvent This is fired when the web context handles any request.

How to use Tag Library of Spring ?

JSP is one of the view technologies that can be used with the Spring Framework. To help for implementing views using Java Server Pages in the Spring, Spring Framework provides you with some tags for evaluating errors, setting themes etc.

The Spring Framework does not provide a full set of tags, useful for all kinds of purposes. The tags which Spring Framework provides are just tags to make the Spring Framework work with Java Server Pages technology efficiently.

These lines of code binds username Property of credential Bean to textbox named username to value entered by user.

 

<spring:bind path="credentials.username">

<input type="text" name="username" value="<core:out value="${status.value}"/>"/>

</spring:bind>

Why use HandlerInterceptors in Spring ?

Spring's handler mapping mechanism has a concept of handler interceptors that can be very much useful when you want to apply specific functionality to certain requests. For example suppose you want to satisfy some request if and only if it comes on some specific time in weekdays then HandlerInterceptors can be more useful.

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

2

3

4

5

6

7

8

9

10

 

No comments:

Post a Comment