Spring Interview Questions and answers

The best and most important Spring Interview questions are mentioned below with easy to understand answers.

Spring IOC Interview Questions

IOC - Inversion Of Control

Suppose there are tow objects A and B. If object A contains object B, we say B is dependency of A
Before spring, in java the dependent object was responsible to create an object of dependency or in other words the dependent has the control of getting dependency. But now with spring this has changed. Now the control goest to dependency or spring framework. This is called 'Inversion of Control'.

Dependency Injection

The process by which spring container/framework injects the dependency into the dependent object is known as dependency injection.
  • Setter Injection
  • Constructor Injection
  • Interface Injection
Note: Spring don't support Interface injection.
Bean Facgtory Application Context
All methods of Interface must be abstract. Abstract class can have abstract methods as well as concrete methods.
All method of interface are abstract and public by default. No such default behaviour for methods of Abstract class.
All variables of Interface are public static final by default. This is not case with Abstract class
Yes, abstract class can have constructor, and infact it always has one. If you don't define explicitly it will have default constructor.
The construcotr is used for inheritance. When you extend a class, you need constructor in that class.

Spring AOP Interview Questions

Abstraction means hiding of unnecessary compalixities from user.
Abstraction means hiding of unnecessary compalixities from user.
Abstraction means hiding of unnecessary compalixities from user.
Abstraction means hiding of unnecessary compalixities from user.
Abstraction means hiding of unnecessary compalixities from user.

Spring MVC Interview Questions

Abstraction means hiding of unnecessary compalixities from user.
Synchronization is the process of accessing shared resources by multiple threads in such a way that no resource can be accessed by multiple thread at one particular moment of time.
Synchronization is the process of accessing shared resources by multiple threads in such a way that no resource can be accessed by multiple thread at one particular moment of time.
In Java synchronization is achieved either through synchronized block or synchronized method.
Abstraction means hiding of unnecessary compalixities from user.

Spring Framework Other Important Questions

Java is platform independent.
Abstraction means hiding of unnecessary compalixities from user.