40+ Spring Interview Questions

40+ Spring Interview Questions

Spring Interview Questions

1) What is Spring? 

It is a lightweight, inexactly coupled and coordinated system for creating endeavor applications in java.

2) What are the upsides of spring system? 

Predefined Templates

Free Coupling

Simple to test


Quick Development

Amazing Abstraction

Explanatory help

3) What are the modules of spring system? 


Spring Core Container

AOP, Aspects and Instrumentation

Information Access/Integration


4) What is IOC and DI? 

IOC (Inversion of Control) and DI (Dependency Injection) is a structure example to give free coupling. It expels the reliance from the program.

How about we compose a code without following IOC and DI.

open class Employee{



address=new Address();//making example



Presently, there is reliance among Employee and Address since Employee is compelled to utilize a similar location occasion.

How about we compose the IOC or DI code.

open class Employee{


Employee(Address address){

this.address=address;//not making case



Presently, there is no reliance among Employee and Address since Employee isn't compelled to utilize a similar location occasion. It can utilize any location example.

5) What is the job of IOC holder in spring? 

IOC holder is mindful to:

make the example

design the occurrence, and

collect the conditions

6) What are the kinds of IOC compartment in spring? 

There are two kinds of IOC compartments in spring structure.



7) What is the distinction among BeanFactory and ApplicationContext? 

BeanFactory is the fundamental compartment though ApplicationContext is the propelled holder. ApplicationContext broadens the BeanFactory interface. ApplicationContext gives a bigger number of offices than BeanFactory, for example, combination with spring AOP, message asset taking care of for i18n and so forth.

8) What is the distinction between constructor infusion and setter infusion? 

No. Constructor Injection Setter Injection

1) No Partial Injection Partial Injection

2) Desn't abrogate the setter property Overrides the constructor property if both are characterized.

3) Creates new case if any alteration occurs Doesn't make new example on the off chance that you change the property estimation

4) Better for such a large number of properties Better for couple of properties.

9) What is autowiring in spring? What are the autowiring modes? 

Autowiring empowers the developer to infuse the bean naturally. We don't have to compose unequivocal infusion rationale.

We should see the code to infuse bean utilizing reliance infusion.

The autowiring modes are given beneath:

No. Mode Description

1) no this is the default mode, it implies autowiring isn't empowered.

2) byName injects the bean dependent on the property name. It utilizes setter technique.

3) byType injects the bean dependent on the property type. It utilizes setter strategy.

4) constructor It infuses the bean utilizing constructor

The "autodetect" mode is belittled since spring 3.

10) What are the distinctive bean scopes in spring? 

There are 5 bean degrees in spring structure.

No. Scope Description

1) singleton The bean example will be just once and same occurrence will be returned by the IOC compartment. It is the default scope.

2) prototype The bean example will be made each time when mentioned.

3) request The bean example will be made per HTTP demand.

4) session The bean occurrence will be made per HTTP session.

5) globalsession The bean occurrence will be made per HTTP worldwide session. It very well may be utilized in portlet setting as it were.

11) In which situation, you will utilize singleton and model extension? 

Singleton degree ought to be utilized with EJB stateless session bean and model extension with EJB stateful session bean.

12) What are the exchange the executives bolsters given by spring? 

Spring structure gives two sort of exchange the board underpins:

Automatic Transaction Management: ought to be utilized for couple of exchange tasks.

Explanatory Transaction Management: ought to be utilized for some exchange tasks.

» Spring JDBC Interview Questions

13) What are the benefits of JdbcTemplate in spring? 

Less code: By utilizing the JdbcTemplate class, you don't have to make connection,statement,start transaction,commit exchange and close association with execute diverse questions. You can execute the inquiry straightforwardly.

14) What are classes for spring JDBC API? 






15) How would you be able to bring records by spring JdbcTemplate? 

You can get records from the database by the inquiry strategy for JdbcTemplate. There are two interfaces to do this:



16) What is the upside of NamedParameterJdbcTemplate? 

NamedParameterJdbcTemplate class is utilized to pass an incentive to the named parameter. A named parameter is superior to ? (question mark of PreparedStatement).

It is smarter to recollect.

17) What is the upside of SimpleJdbcTemplate? 

The SimpleJdbcTemplate bolsters the element of var-args and autoboxing.

» Spring AOP Interview Questions

18) What is AOP? 

AOP is an abbreviation for Aspect Oriented Programming. It is a philosophy that isolates the program rationale into pieces or parts or concerns.

It builds the measured quality and the key unit is Aspect.

19) What are the upsides of spring AOP? 

AOP empowers you to progressively include or evacuate worry previously or after the business rationale. It is pluggable and simple to keep up.

20) What are the AOP phrasing? 

AOP phrasings or ideas are as per the following:






Target Object


AOP Proxy


21) What is JoinPoint? 

JoinPoint is any point in your program, for example, field get to, strategy execution, special case taking care of and so on.

22) Does spring system bolster all JoinPoints? 

No, spring structure bolsters strategy execution joinpoint as it were.

23) What is Advice? 

Counsel speaks to move made by perspective.

24) What are the sorts of counsel in AOP? 

There are 5 sorts of advices in spring AOP.

Prior to Advice

After Advice

In the wake of Returning Advice

Tosses Advice

Around Advice

25) What is Pointcut? 

Pointcut is articulation language of Spring AOP.

26) What is Aspect? 

Perspective is a class in spring AOP that contains advices and joinpoints.

27) What is Introduction? 

Presentation speaks to presentation of new fields and techniques for a sort.

28) What is target object?

Target Object is an intermediary object that is prompted by at least one perspectives.

29) What is interceptor? 

Interceptor is a class like viewpoint that contains one guidance as it were.

30) What is weaving? 

Weaving is a procedure of connecting viewpoint with other application.

31) Does spring perform weaving at order time? 

No, spring system performs weaving at runtime.

32) What are the AOP usage? 

There are 3 AOP usage.

Spring AOP

Apache AspectJ


» Spring MVC Interview Questions

33) What is the front controller class of Spring MVC? 

The DispatcherServlet class fills in as the front controller in Spring MVC.

34) What does @Controller comment? 

The @Controller comment denotes the class as controller class. It is connected on the class.

35) What does @RequestMapping comment? 

The @RequestMapping comment maps the solicitation with the strategy. It is connected on the strategy.

36) What does the ViewResolver class? 

The View Resolver class settle the view part to be summoned for the solicitation. It characterizes prefix and addition properties to determine the view segment.

37) Which ViewResolver class is generally utilized? 

The org.springframework.web.servlet.view.InternalResourceViewResolver class is generally utilized.

38) Does spring MVC give approval support?