Spring Interview Questions


Question: HWhat is Aspect Oriented programming (AOP) ?And Howdoes AOP used in Spring ?
  Question: What do you mean by Aspect in AOP?  
Question:  What do you mean by JointPoint?
Question:  What do you mean by Advice?  
Question:  What are the types of Advice?
Question:  What do you mean by pointcut?
Question:  What do you understand by aop proxy?
Question: Are there any ways to pass value of property of a bean as NULL ?
Question:  If the Value tag is empty then what will be passed as value to the property of the bean?
Question:  Can there be any custom scope that can be defined and used along with other Springconfigurations declaratively and programmatically?
Question:  What represents a Model in Spring's MVC architecture?
Question:  In Spring's Web MVC Architecture, is it required to have the Model class uses frameworkspecific class or interface?
Question: In Spring Web MVC, can the Controller implementation be able to write directly to the output/response stream?
Question: What are the ways one can achive view resolution in Spring Web MVC?

Question:

Are there any view resolver those having caching mechanism associated with? If yes, what are those view resolver?

Question:

How input data validation is handled while using Spring's Web MVC?

Question:

Can any object is used as command while using Spring Framework Web MVC?

Question:

What basic elements ModelAndView instance contains?

Question:

What are the different values a View element can have?

Question:

What are the various Special beans instances can be found/associated with Spring's WebApplicationContext instance?

Q:

What is Aspect Oriented programming (AOP) ?And Howdoes AOP used in Spring ?

A:

Aspect-oriented programming, or AOP, is a programming technique that allowsprogrammers to modularize crosscutting concerns, or behavior that cuts across the typical divisions of responsibility, such as logging and transaction management. The core construct of AOP is the aspect, which encapsulates behaviors affecting multiple classes into reusable modules.

AOP is used in the Spring Framework: To provide declarative enterprise services, especially as a replacement for EJB declarative services. The most important such service is declarative transaction management, which builds on the Spring Framework's transaction abstraction.To allow users to implement custom aspects, complementing their use of OOP with AOP.

 

Q:

What do you mean by Aspect in AOP?

A:

Aspects mean modularization of a concern that cuts across multiple classes. Transaction management is a good example of a crosscutting concern in J2EE applications. In my words: a trigger which can affect the multiple classes at one point.

 

Q:

What do you mean by JointPoint?

A: A point during the execution of a program, such as the execution of a method or the handling of an exception. In Spring AOP, a join point always represents a method execution. 
 

Q:

What do you mean by Advice?

A: Action taken by an aspect at a particular join point. Different types of advice include "around," "before" and "after" advice. Many AOP frameworks, including Spring, model an advice as an interceptor, maintaining a chain of interceptors "around" the join point.
 

Q:

What are the types of Advice?

A:

Before advice: Advice that executes before a join point, but which does not have the ability to prevent execution flow proceeding to the join point (unless it throws an exception).

After returning advice: Advice to be executed after a join point completes normally: for example, if a method returns without throwing an exception.

After throwing advice: Advice to be executed if a method exits by throwing an exception.

After (finally) advice: Advice to be executed regardless of the means by which a join point exits (normal or exceptional return).

Around advice: Advice that surrounds a join point such as a method invocation. This is the most powerful kind of advice. Around advice can perform custom behavior before and after the method invocation. It is also responsible for choosing whether to proceed to the join point or to shortcut the advised method execution by returning its own return value or throwing an exception.

 

Q:

What do you mean by pointcut?

A: A predicate that matches join points. Advice is associated with a pointcut expression and runs at any join point matched by the pointcut (for example, the execution of a method with a certain name). The concept of join points as matched by pointcut expressions is central to AOP, and Spring uses the AspectJpointcut expression language by default. In my words a criteria used to locate point.
 

Q:

What do you understand by aop proxy?

A: An object created by the AOP framework in order to implement the aspect contracts (advise method executions and so on). In the Spring Framework, an AOP proxy will be a JDK dynamic proxy or a CGLIB proxy.
 

Q:

Are there any ways to pass value of property of a bean as NULL ?

A:

Yes, By using NULL tag for passing as property's value.

 

Q:

If the Value tag is empty then what will be passed as value to the property of the bean?

A: An empty string "" will be passed as value to the property tag if empty valuetag is present in property tag of a bean such as follows:
<property name="">< value/><property/>
 

Q:

Can there be any custom scope that can be defined and used along with other Springconfigurations declaratively and programmatically?

A: Yes, one can define custom scope for the bean while scope can be registeredprogrammatically and can be used in configuration file declaratively.
 

Q:

What represents a Model in Spring's MVC architecture?

A:

Spring's Model is based on Map interface, so by this abstraction of Model, loose coupling between View and Model is achieved in Spring Web MVC implementation.

 

 
Q: In Spring's Web MVC Architecture, is it required to have the Model class uses frameworkspecific class or interface?
A: No, it is not required to have the model implementation depend on Spring's Frameworkspecific class or interface. Spring's Model can be a POJO with no dependency on Spring's Framework class files.
   
   

Q:

In Spring Web MVC, can the Controller implementation be able to write directly to the output/response stream?

A:

Yes, in Spring Web MVC, Controller can write content to the output/response stream.

 

Q:

What are the ways one can achive view resolution in Spring Web MVC?

A:

One can achive view resolution in Spring Web MVC by view configuration using bean names,a properties file or custom ViewResolver implementation by user.

 

Q:

Are there any view resolver those having caching mechanism associated with? If yes, what are those view resolver?

A:

ResourceBundleViewResolver, UrlBasedViewResolver, XmlViewResolver are the resolvers having caching mechanism associated with these.

 
 
Q:

How input data validation is handled while using Spring's Web MVC?

A:

Input data type mismatch is captured as validation error while workingwith Spring Web MVC Framework.

 
 
Q:

Can any object is used as command while using Spring Framework Web MVC?

A:

Yes, any object can be used as Command object while using Spring Web MVC.

 
 
Q:

What basic elements ModelAndView instance contains?

A:

View name and Model as Map element can be found in ModelAndView instance.

 
 
Q:

What are the different values a View element can have?

A:

View name or value can be bean name, a properties file name or a customViewResolver name.

 
 
Q:

What are the various Special beans instances can be found/associated with Spring's WebApplicationContext instance?

A:

Controller instance, Handling mapping, various resolvers such as view resolvers, locale resolvers, Theme resolver, exception handler resolvers, multipart file resolvers.

 



Spring Interview Questions

Similar Topics
Forum For Java Interview Questions new

Java Interview Questions
Java Collection Interview Questions
JSP Interview Questions
Servlet Interview Questions
EJB Interview Questions
JMS Interview Questions
Struts Interview Questions
Spring Interview Questions
WMB Interview Questions
DB Interview Questions

Use of this website constitutes acceptance of the AllAppLabs.com Terms and Conditions