Spring Interview Questions & Answers

Spring Interview Questions & Answers Freshers and Experienced

Is it true that you are considering Spring Framework as your career after your vocation in Spring Framework? Is it true to say that you are searching for a spring interview question and answers? Then you have landed in the right place. Here is a list of Spring interview questions & answers which may be asked during your interview. These interview questions and answers will surely help you during your interview session.

After the release, the Spring Framework has kept on sprouting in the market. Spring community group is persistently thinking of new things and have spread into an immense biological system. Today, it holds the top position in the structure showcase.

Spring Interview Questions & Answers

Here are the Top 50 Spring Interview Questions which are well on the way to be asked by the interviewer during your job interview. On the off chance that you are looking for a future in this field, these question will without a doubt help you to full fill your dream.

1. What is a Spring Framework?

Spring Framework is a Java-based platform that gives a comprehensive foundation for creating Java applications. Spring handles the foundation so you can concentrate on your application.

Spring empowers you to construct applications from “plain old Java objects” (POJOs) and to apply venture administrations non-intrusively to POJOs. This ability applies to the Java SE programming model and to full and halfway Java EE.

2. Advantages of Spring Framework

Some of the major advantages of Spring Framework.

  • Spring empowers the developers to create applications using POJOs (Plain Old Java Object). The advantage of building up the applications utilizing POJO is, that we don’t need an undertaking compartment, for example, an application server however we have the alternative of utilizing a powerful servlet holder.
  • Spring gives a deliberation layer on existing innovations like servlets, JSPS, JDBC, JNDI, RMI, JMS and Java mail and so forth, to improve the development procedure.
  • Spring accompanies a portion of the current innovations like ORM system, logging structure, J2EE and JDK Timers and so forth, Hence we don’t have to incorporate expressly those advancements.
  • Spring WEB structure has a well-planned web MVC system, which gives an extraordinary interchange to a legacy web structure.
  • Spring can kill the formation of the singleton and factory classes.
  • Spring gives a reliable transaction management interface that can downsize to a nearby exchange and scale up to worldwide exchanges (utilizing JTA).
  • Spring framework incorporates support for overseeing business questions and presenting their administrations to the introduction level parts, with the goal that the web and work area applications can get to similar articles.
  • Spring framework has taken the best practice that has been demonstrated throughout the years in a few applications and formalized as configuration designs.
  • Spring application can be utilized for the improvement of various sort of uses, as independent applications, independent GUI applications, Web applications and applets too.
  • Spring support both XML and annotation setups.
  • Spring Framework permits to create independent, work area, 2 tire – n-tire design and disseminated applications.
  • Spring gives worked in middleware administrations like Connection pooling, Transaction the executives and so forth.
  • Spring gives a lightweight compartment which can be activated without utilizing a web server or application server.

3. What are the different features of the Spring Framework?

Lightweight: spring framework is lightweight with regards to size and straightforwardness. The essential adaptation of the spring system is around 1MB.

Inversion of control (IOC): Loose coupling is accomplished in spring, with the help of the strategy Inversion of Control.

Aspect-oriented Programming (AOP): Spring Framework supports Aspect arranged programming and empowers firm advancement by isolating application business rationale from framework administrations.

Container: Spring contains and deals with the existence cycle and setup of utilization objects.

MVC Framework: Spring accompanies MVC web application structure, based on center Spring usefulness. This structure is profoundly configurable by means of procedure interfaces and obliges different view advances like JSP, Velocity, Tiles, iText, and POI. Yet, different structures can be effectively utilized as opposed to Spring MVC Framework.

Transaction Management: Spring system gives a conventional deliberation layer to exchange the board. This enabling the engineer to include the pluggable exchange supervisors, and making it simple to divide exchanges without managing low-level issues. Spring’s exchange backing isn’t attached to J2EE situations and it tends to be additionally utilized in compartment fewer conditions.

JDBC Exception Handling: The JDBC reflection layer of the Spring offers an important exemption pecking order, which improves the blunder taking care of technique. Joining with Hibernate, JDO, and iBATIS: Spring gives best Integration administrations Hibernate, JDO, and iBATIS

4. How many modules are there in Spring Framework and what are they?

There are approx 20 modules which are categorized into Core Container, Data Access/Integration, Web, AOP (Aspect Oriented Programming), Instrumentation and Test.

  • Spring Core Container – This layer is basically the core of Spring Framework. It contains the following modules :
  1. Spring Core
  2. Spring Bean
  3. SpEL (Spring Expression Language)
  4. Spring Context 
  • Data Access/Integration – This layer provides support to interact with the database. It contains the following modules :
  1. JDBC (Java DataBase Connectivity)
  2. ORM (Object Relational Mapping)
  3. OXM (Object XML Mappers)
  4. JMS (Java Messaging Service)
  5. Transaction
  • Web – This layer provides support to create a web application. It contains the following modules :
  1. Web
  2. Web – MVC
  3. Web – Socket
  4. Web – Portlet
  • Aspect Oriented Programming (AOP) – In this layer you can use Advice, Pointcuts, etc., to decouple the code.
  • Instrumentation – This layer provides support to class instrumentation and classloader implementations.
  • Test – This layer provides support to testing with JUnit and TestNG.

Few Miscellaneous modules are given below:

  • Messaging – This module provides support for STOMP. It also supports an annotation programming model that is used for routing and processing STOMP messages from WebSocket clients.
  • Aspects – This module provides support to the integration with AspectJ.

5. What is a Spring configuration file?

A Spring configuration file is an XML document. This record, for the most part, contains the classes data. It explains how those classes are arranged just as acquainted with one another. The XML design documents, however, are verbose and all the more spotless. In the event that it’s not arranged and composed accurately, it turns out to be extremely hard to oversee in enormous tasks.

6. What are the different components of a Spring application?

7. What are the various ways of using the Spring Framework?

8. What is the Spring IOC Container?

9. What do you mean by Dependency Injection?

10 In how many ways can Dependency Injection be done?

11 Differentiate between constructor injection and setter injection.

12 What are the major features in different versions of Spring Framework?

13 How many types of IOC containers are there in spring?

14 Differentiate between BeanFactory and ApplicationContext.

15 List some of the benefits of IoC.

16 Explain Spring Beans?

17 How configuration metadata is provided to the Spring container?

18 How many bean scopes are supported by Spring?

19 What is the Bean life cycle in Spring Bean Factory Container?

20 Explain inner beans in Spring.

21 Define Bean Wiring.

22 What do you understand by auto wiring and name the different modes of it?

23 What are the limitations with auto-wiring?

24 What do you mean by Annotation-based container configuration?

25 How annotation wiring can be turned on in Spring?

26 What’s the difference between @Component, @Controller, @Repository & @Service annotations in Spring?

27 What do you understand by @Required annotation?

28 What do you understand by @Autowired annotation?

29 What do you understand by @Qualifier annotation?

30 What do you understand by @RequestMapping annotation?

31 Describe Spring DAO support?

32 Name the exceptions thrown by the Spring DAO classes.

33 Which classes are present in spring JDBC API?

34 What are the ways by which Hibernate can be accessed using Spring?

35 Name the types of transaction management that Spring supports.

36 What are the different ORM’s supported by Spring?

37 Describe AOP.

38 What do you mean by Aspect?

39 Explain JoinPoint.

40 What is Advice?

41 What are the different types of Advice?

42 Point out the difference between concern and cross-cutting concern in Spring AOP?

43 What are the different AOP implementations?

44 What is the difference between Spring AOP and AspectJ AOP?

45 What do you mean by Proxy in Spring Framework?

46 In Spring, what is Weaving?

47 What do you mean by Spring MVC framework?

48 Describe DispatcherServlet.

49 Explain WebApplicationContext.

50 In Spring MVC framework, what is the controller?