Spring Framework Interview Guide - 200+ Questions & Answers

Get Ready for Your Spring Interview with Spring, Spring Boot, RESTful, SOAP Web Services and Spring MVC

Spring Framework is the most popular Java Framework ever. It continues to evolve with changing architectures. Spring Boot is one of the most popular Spring projects. Spring Boot is the most used Java framework to develop RESTful Services and Microservices.

Preparing for Spring Interview is tricky. There are wide variety of Spring Modules and Spring Projects you would need to recollect and be prepared to answer questions on.You would need to get a good understanding of the new features of Spring and have firm grasp of the concepts you implemented in your projects.

This course helps you prepare for Spring Interview with code examples covering 200+ Spring Interview Questions and Answers on Spring, Spring Boot, Spring MVC, Spring JDBC, JPA, AOP, RESTful Services and SOAP Web Services.

List of questions discussed about each topic is listed below.

Spring

  1. What is Loose Coupling?
  2. What is a Dependency?
  3. What is IOC (Inversion of Control)?
  4. What is Dependency Injection?
  5. Can you give few examples of Dependency Injection?
  6. What is Auto Wiring?
  7. What are the important roles of an IOC Container?
  8. What are Bean Factory and Application Context?
  9. Can you compare Bean Factory with Application Context?
  10. How do you create an application context with Spring?
  11. How does Spring know where to search for Components or Beans?
  12. What is a Component Scan?
  13. How do you define a component scan in XML and Java Configurations?
  14. How is it done with Spring Boot?
  15. What does @Component signify?
  16. What does @Autowired signify?
  17. What’s the difference Between @Controller, @Component, @Repository, and @Service Annotations in Spring?
  18. What is the default scope of a bean?
  19. Are Spring beans thread safe?
  20. What are the other scopes available?
  21. How is Spring’s singleton bean different from Gang of Four Singleton Pattern?
  22. What are the different types of dependency injections?
  23. What is setter injection?
  24. What is constructor injection?
  25. How do you choose between setter and constructor injections?
  26. What are the different options available to create Application Contexts for Spring?
  27. What is the difference between XML and Java Configurations for Spring?
  28. How do you choose between XML and Java Configurations for Spring?
  29. How does Spring do Autowiring?
  30. What are the different kinds of matching used by Spring for Autowiring?
  31. How do you debug problems with Spring Framework?
  32. How do you solve NoUniqueBeanDefinitionException?
  33. How do you solve NoSuchBeanDefinitionException?
  34. What is @Primary?
  35. What is @Qualifier?
  36. What is CDI (Contexts and Dependency Injection)?
  37. Does Spring Support CDI?
  38. Would you recommed to use CDI or Spring Annotations?
  39. What are the major features in different versions of Spring?
  40. What are new features in Spring Framework 4.0?
  41. What are new features in Spring Framework 5.0?
  42. What are important Spring Modules?
  43. What are important Spring Projects?
  44. What is the simplest way of ensuring that we are using single version of all Spring related dependencies?
  45. Name some of the design patterns used in Spring Framework?
  46. What do you think about Spring Framework?
  47. Why is Spring Popular?
  48. Can you give a big picture of the Spring Framework?

Spring MVC

  1. What is Model 1 architecture?
  2. What is Model 2 architecture?
  3. What is Model 2 Front Controller architecture?
  4. Can you show an example controller method in Spring MVC?
  5. Can you explain a simple flow in Spring MVC?
  6. What is a ViewResolver?
  7. What is Model?
  8. What is ModelAndView?
  9. What is a RequestMapping?
  10. What is Dispatcher Servlet?
  11. How do you set up Dispatcher Servlet?
  12. What is a form backing object?
  13. How is validation done using Spring MVC?
  14. What is BindingResult?
  15. How do you map validation results to your view?
  16. What are Spring Form Tags?
  17. What is a Path Variable?
  18. What is a Model Attribute?
  19. What is a Session Attribute?
  20. What is a init binder?
  21. How do you set default date format with Spring?
  22. Why is Spring MVC so popular?

Spring Boot

  1. What is Spring Boot?
  2. What are the important Goals of Spring Boot?
  3. What are the important Features of Spring Boot?
  4. Compare Spring Boot vs Spring?
  5. Compare Spring Boot vs Spring MVC?
  6. What is the importance of @SpringBootApplication?
  7. What is Auto Configuration?
  8. How can we find more information about Auto Configuration?
  9. What is an embedded server? Why is it important?
  10. What is the default embedded server with Spring Boot?
  11. What are the other embedded servers supported by Spring Boot?
  12. What are Starter Projects?
  13. Can you give examples of important starter projects?
  14. What is Starter Parent?
  15. What are the different things that are defined in Starter Parent?
  16. How does Spring Boot enforce common dependency management for all its Starter projects?
  17. What is Spring Initializr?
  18. What is application.properties?
  19. What are some of the important things that can customized in application.properties?
  20. How do you externalize configuration using Spring Boot?
  21. How can you add custom application properties using Spring Boot?
  22. What is @ConfigurationProperties?
  23. What is a profile?
  24. How do you define beans for a specific profile?
  25. How do you create application configuration for a specific profile?
  26. How do you have different configuration for different environments?
  27. What is Spring Boot Actuator?
  28. How do you monitor web services using Spring Boot Actuator?
  29. How do you find more information about your application envrionment using Spring Boot?
  30. What is a CommandLineRunner?

Database Connectivity - JDBC, Spring JDBC & JPA

  1. What is Spring JDBC? How is different from JDBC?
  2. What is a JdbcTemplate?
  3. What is a RowMapper?
  4. What is JPA?
  5. What is Hibernate?
  6. How do you define an entity in JPA?
  7. What is an Entity Manager?
  8. What is a Persistence Context?
  9. How do you map relationships in JPA?
  10. What are the different types of relationships in JPA?
  11. How do you define One to One Mapping in JPA?
  12. How do you define One to Many Mapping in JPA?
  13. How do you define Many to Many Mapping in JPA?
  14. How do you define a datasource in a Spring Context?
  15. What is the use of persistence.xml
  16. How do you configure Entity Manager Factory and Transaction Manager?
  17. How do you define transaction management for Spring – Hibernate integration?

Spring Data

  1. What is Spring Data?
  2. What is the need for Spring Data?
  3. What is Spring Data JPA?
  4. What is a CrudRepository?
  5. What is a PagingAndSortingRepository?

Unit Testing

  1. How does Spring Framework Make Unit Testing Easy?
  2. What is Mockito?
  3. What is your favorite mocking framework?
  4. How do you do mock data with Mockito?
  5. What are the different mocking annotations that you worked with?
  6. What is MockMvc?
  7. What is @WebMvcTest?
  8. What is @MockBean?
  9. How do you write a unit test with MockMVC?
  10. What is JSONAssert?
  11. How do you write an integration test with Spring Boot?
  12. What is @SpringBootTest?
  13. What is @LocalServerPort?
  14. What is TestRestTemplate?

AOP

  1. What are cross cutting concerns?
  2. How do you implement cross cutting concerns in a web application?
  3. If you would want to log every request to a web application, what are the options you can think of?
  4. If you would want to track performance of every request, what options can you think of?
  5. What is an Aspect and Pointcut in AOP?
  6. What are the different types of AOP advices?
  7. What is weaving?
  8. Compare Spring AOP vs AspectJ?

SOAP Web Services

  1. What is a Web Service?
  2. What is SOAP Web Service?
  3. What is SOAP?
  4. Waht is a SOAP Envelope?
  5. What is SOAP Header and SOAP Body?
  6. Can you give an example of SOAP Request and SOAP Response?
  7. What is a SOAP Header? What kind of information is sent in a SOAP Header?
  8. Can you give an example of a SOAP Header with Authentication information?
  9. What is WSDL (Web Service Definition Language)?
  10. What are the different parts of a WSDL?
  11. What is Contract First Approach?
  12. What is an XSD?
  13. Can you give an example of an XSD?
  14. What is JAXB?
  15. How do you configure a JAXB Plugin?
  16. What is an Endpoint?
  17. Can you show an example endpoint written with Spring Web Services?
  18. What is a MessageDispatcherServlet?
  19. How do you configure a MessageDispatcherServlet?
  20. How do you generate a WSDL using Spring Web Services?
  21. How do you implement error handling for SOAP Web Services?
  22. What is a SOAP Fault?

RESTful Web Services

  1. What is REST?
  2. What are the key concepts in designing RESTful API?
  3. What are the Best Practices of RESTful Services?
  4. Can you show the code for an example Get Resource method with Spring REST?
  5. What happens when we return a bean from a Request Mapping Method?
  6. What is GetMapping and what are the related methods available in Spring MVC?
  7. Can you show the code for an example Post Resource method with Spring REST?
  8. What is the appropriate HTTP Response Status for successful execution of a Resource Creation?
  9. Why do we use ResponseEntity in a RESTful Service?
  10. What is HATEOAS?
  11. Can you give an Example Response for HATEOAS?
  12. How do we implement it using Spring?
  13. How do you document RESTful web services?
  14. Can you give a brief idea about Swagger Documentation?
  15. How do you automate generation of Swagger Documentation from RESTful Web Services?
  16. How do you add custom information to Swagger Documentation generated from RESTful Web Services?
  17. What is Swagger-UI?
  18. What is "Representation" of a Resource?
  19. What is Content Negotiation?
  20. Which HTTP Header is used for Content Negotiation?
  21. How do we implement it using Spring Boot?
  22. How do you add XML support to your RESTful Services built with Spring Boot?
  23. How do you implement Exception Handling for RESTFul Web Services?
  24. What are the best practices related to Exception Handling with respect to RESTful Web Services?
  25. What are the different error status that you would return in RESTful Web Services?
  26. How would you implement them using Spring Boot?
  27. What HTTP Response Status do you return for validation errors?
  28. How do you handle Validation Errors with RESTful Web Services?
  29. Why do we need Versioning for RESTful Web Services?
  30. What are the versioning options that are available?
  31. How do you implement Versioning for RESTful Web Services?
Who is the target audience?
  • You are learning Java
  • You are learning Spring
  • You want to attend Java & Spring Interviews
  • You want to add more depth to your Spring Knowledge


Your Instructor


in28Minutes
in28Minutes

in28Minutes is the world's leading course provider for Spring Framework with more than 100,000 students pursuing our courses on in28Minutes Platform(https://courses.in28minutes.com), Udemy and YouTube.

Brain child of Ranga Karanam, an Architect with 15 Years of Java programming and design with major banking clients across the world, we started in28Minutes with the aim to create Hands-on Courses with Real World Projects.

We use 80-20 Rule. We discuss 20% things used 80% of time in depth. We touch upon other things briefly equipping you with enough knowledge to find out more on your own.

We love open source and therefore, All our code is open source too and available on Github.


Course Curriculum


  Congratulations
Available in days
days after you enroll

Frequently Asked Questions


When does the course start and finish?
The course starts now and never ends! It is a completely self-paced online course - you decide when you start and when you finish.
How long do I have access to the course?
How does lifetime access sound? After enrolling, you have unlimited access to this course for as long as you like - across any and all devices you own.
What if I am unhappy with the course?
We would never want you to be unhappy! If you are unsatisfied with your purchase, contact us in the first 30 days and we will give you a full refund.

This course is closed for enrollment.