Spring Interview Questions and Answers

0

The IT industry has always been rising since the day they invented abacus. New programming languages, IDEs, frameworks, etc. are coming into existence with each passing day. We are going to talk about another promising, open source framework for Enterprise Java i.e. Spring. The increase in a number of people getting familiar with them has toughened the process of employment. In order to make through an interview, you will need to step up your game and prepare for any question which they throw at you. Luckily, we’ve got your back.

Below are top Basic and Advanced Spring Interview Questions, along with answers, asked in a Spring interview:

Basic Questions

1.      What is Spring?

Spring is an open source development framework used for Java. Spring framework can be used in the development of any Java application, however, on top of Java EE platform there are other extensions which help in building web applications. It simplifies the work and promotes POJO-based programming model, which is a good programming practice.

2.      What are the features of Spring?

Light Weight:

When it comes to size and transparency Spring is a lightweight framework. The basic version of the framework is roughly around 1MB only.

Inversion of Control (IOC):

Spring enables the loose coupling with the help of Inversion of Control. Instead of creating or looking for other dependent objects, the objects give their dependencies on their own.

Container:

Spring manages to contain the life cycle and configurations of application objects.

JDBC Exception Handling:

SpringJDBC framework handles all kinds of database-related exceptions for you. Spring also provides the best integration with Hibernate, JDO, and iBATIS.

Transaction Management:

The managers can add pluggable transaction managers by virtue of Spring. It simplifies the division of transactions without dealing with the low-level issues.

3.      Describe the spring framework?

If you are looking for a comprehensive programming and configuration model for modern Java, Spring will be your best option since it is capable of helping you with any Java-based enterprise applications irrespective of the type of deployment platform.

4.      What are the Spring framework modules?

  • Core module
  • Bean module
  • Context module
  • JDBC module
  • ORM module
  • OXM module
  • Web module
  • Web-Servlet module
  • Web-Struts module
  • Web-Portlet module
  • Expression Language module
  • Java Messaging Service(JMS) module

Advanced Questions

1.      What are the types of Dependencies Injection Spring supports?

Setter Injection:

The realization of Setter-based DI is done by calling the setter methods on user’s bean. The calling is done after a no-argument static factory or no-argument constructor method is invoked in order to instantiate their bean.

Constructor Injection:

Constructor-based ID is realized by invoking a constructor with a number of arguments, collaborator represented by each one of them.

2.      What is the Spring IOC Container?

The Spring IOC creates and wires objects together. It configures and manages the life cycles of objects as well, from creation to destruction. A Dependency Injection (DI) is used to manage the components of an application.

3.      What are Spring beans?

Managed by the Spring IOC Containers, Beans are what actually formulate the backbone of any application. Any object that has been instantiated, assembled and managed by a Spring IOC container is called bean. With the help of configuration metadata provided by the user, beans are created.

4.      What Bean Scopes does Spring support? Explain them.

Singleton:

This scopes the bean definition to a single instance per Spring IOC container.

Prototype:

If the scope of a single bean definition extends to any number of object instances, it is a prototype.

Request/session/Global Session:

All of these extend beans definition to only HTTP sessions.  The presence of web-aware Spring ApplicationContext is important to validate these.

Share.

About Author

Shahid Rasool

SEO/Social Media specialist, have been in internet marketing Industry for 8 plus years.

Comments are closed.

Translate »