Spring Framework

Spring Framework - MVC, Dependency Injection, Spring Hibernate, Spring Data JPA, Spring Boot and Spring Cloud for Microservices Architecture.

The Spring Framework is an application framework and inversion of control container for the Java platform. It’s different modules are widely used in most Java Projects across IT Industry.

Spring Core and Dependency Injection

  1. How to properly @Inject a Protoype Bean into a Singleton bean in Spring

  2. What are different Bean Scopes?

  3. Two Beans with same name exists in the AppContext, how to resolve them during autowiring?

  4. Service’s first method calls its second method annotated with Async annotation, what will be behavior?

  5. Difference between @Component @Repository @Controller @RestController and @Service

  6. How will you create a single threaded pipeline for a particular task execution using Spring?

  7. How will you handle unresolved circular dependency in spring dependency injection?

Spring MVC

  1. How to handle Basic Auth in Spring RestTemplate?

  2. What are new features in Spring 4

  3. What are new features in Spring 5

  4. RestTemplate vs WebClient in Spring 5

  5. How will you design & implement a referral program using Spring MVC? using unique Affiliation id assigned to brokers?

  6. How will you Design and implement a highly scalable Quote Engine Using Spring MVC? - Deferred Result, Async Processing?

  7. How to intercept HTTP Rest calls that take too much time in processing?

  8. Spring REST Validation mechanism?

  9. How to implement Long Polling using Spring MVC?

  10. How to implement a Download Server with Spring MVC that does not block Servlet Container Thread?

  11. Mention few DeferredResult Usecase?

  12. Spring MVC validations.

  13. File uploading in Spring MVC

  14. High Level approach to integrate your web app with facebook.

  15. Redirect Attributes? Spring MVC?

  16. How to prevent duplicate form submission in spring mvc?

  17. How to send errors back to form using PRG Pattern?

  18. Setter vs Constructor based dependency injection in spring? pros and cons of each?

Hibernate and Spring Data JPA

  1. How to prevent lost updates using Hibernate/JDBC/Data-JPA?

  2. How to stream all records from a table using Spring Data JPA?

  3. How will you efficiently increment number of visits on a Article using Spring Data JPA? Using @Modifying & @Query

  4. How does Projections work in Spring Data JPA?

  5. LockingModeType Optimistic/Pessimistic and Force Increment in Spring Data JPA.

  6. How to store Tags List<String> in JPA?

  7. Spring, JPA, and Hibernate - how to increment a counter without concurrency issues?

  8. How to solve N+1 Problem in Hibernate and Spring data

  9. How will you map id of one table to be served a id in another table using Hibernate? What could be a real usecase?

  10. What are different approaches for implementing inheritance hierarchy in JPA/Hibernate?

    Hint: Table per concrete class, table per class hierarchy and table per subclass

  11. Can Hibernate SessionFactory and Session be used across multiple threads safely?

  12. What is Lazy Loading? How to enable it? How to allow web layer to access lazily loaded attributes?

  13. What is Dirty Checking in Hibernate?

  14. What is difference between get and load in hibernate?

  15. What is advantages and disadvantages of using a ORM?

  16. What is a detached object in hibernate? What are different instance states in hibernate?

  17. What is a named query? how will you create a named query?

  18. How to invoke a stored procedure using Hibernate?

  19. How to debug Hibernate SQL statements?

  20. What is difference between a sorted collection and ordered collection in hibernate?

  21. How will you make sure that email is only sent if the transaction succeeds in the givens service method?

  22. How to implement Optimistic Locking in hibernate?

Hibernate Tutorials

  • Design a Login Module using Hibernate

  • Design Product Catalog Schema using Hibernate - product can be of two types - Digital Products and Normal Products

Hibernate Interview

  • Top Hibernate Interview Questions for experienced Java Programmer

  • Top Hibernate Interview Questions for Investment Banking Domain

Spring Boot

Spring Cloud

  1. What are Cloud Native Apps?

  2. What is Spring Cloud?

Spring Microservices

  1. What are principles of Microservices Architecture - 12 factor APP?

  2. Microservices vs Monolith

  3. Microservices vs SOA

  4. Microservices vs Small Services

  5. Architecture of Microservices

  6. Challenges with Microservices

  7. What Problems Do Microservices Solve?

  8. Security in Microservices

  9. What Microservices actually are?

  10. getting-started-with-spring-boot-and-microservices

  11. 12-factor-or-cloud-native-apps-for-spring-develope

Important Books & References

It is always better to practice on a project than to just cram different questions from a book.

There are good books to read on Spring Framework, though

  • Spring in Action

  • Spring Boot Official Documentation

  • Spring Cloud Official Documentation

Design Tutorials

  • Design a highly scalable HTTP Download microservice using Spring Boot

  • Implement a Simple File Storage Microservice using Spring Cloud

  • Implement a scalable URL shortner Service

  • Implement end to end Spring Boot Microservice and deploy it on Unix as a service




Buy DRM Free PDF for Complete Collection of Interview Questions
product image
ebook PDF - Cracking Java Interviews v3.5 by Munish Chandel

240 real Java interview questions on core Java, concurrency, algorithms, design & data structures, spring, hibernate for Investment Bank, Healthcare IT, product and service based companies, Author : Munish Chandel, Price: 250, Type: PDF