5+ Years experienced Spring boot and microservices Interview questions

Manoj Pandey
Javarevisited
Published in
3 min readOct 12, 2021

As promised in my previous post that I will share interview questions for advance topics like spring boot and microservices ,here are few questions that I encountered repeatedly in many interviews….

Spring Boot:

  1. Why to use spring boot? Difference between spring boot and spring MVC?
  2. Difference between @service and @repository annotation ? @controller vs @RestController annotations ? Try to prepare and understand all the annotations which is being used in spring boot. Some time people ask to explain all the important annotations of spring boot.(Answer)
  3. Explain @SpringBootApplication annotation , this is very basic question but there are multiple follow up questions with this so try to understand this annotation internally .And sometime interviewer also ask the internal working of run() method in main method.
  4. How have you done profiling in your spring boot application ? this question is basically to know that you have really worked on spring boot project. Although its very simple question but very important in terms of interview.
  5. Implement saveEmployee() method in spring boot . Now a days interviewers try to check hands on by giving a small use case to implement like getEmployee() or saveEmployee() from controller to repository layer and in follow up they will ask to handle exceptions as well. So be prepared for exception handling scenarios in spring boot like how to use @ControllerAdvice and @ExceptionHandler annotations.
  6. How to implement pagination using spring data jpa ?
  7. How to change default server and port in spring boot ?
  8. Difference between PUT and PATCH http methods ?
  9. Difference between @RequestBody ,@RequestParam and @PathVariable annotations ?
  10. Use of different http status code like 404,403, 401,500,502 etc .

Microservices:

  1. What is microservices? All the microservices interview starts with this question . Its very simple but difficult to explain so be prepared with explanation about microservices architecture and you can also handle this question by explaining difference between monolithic and microservices architecture.
  2. What will be your approach to migrate monolithic application to microservices ?

3. Microservice Service A calls to Service B and Service B calls to service C ,if Service B is down or not responding then how to handle this situation in microservices ,Or which design pattern is suitable for this scenario ?

4. How to implement Service discovery and Api gateway for your microservices ? How eureka server works internally? There can be multiple follow up questions with service discovery like what is heartbeat in Eureka server? How one service get registered with Eureka server automatically? What is the default port of eureka server? How to turn off fetch registry from Eureka server ? And Why we need to turn off fetch registry from server side ? What is the significance of Api gateway in microservice. ?

5. How to implement distributed logging in microservices architecture.

6. How to handle transactions in microservices architecture?

7. At which layer we implement security in microservices ?

8. How to use feign client ?

Here I have added some spring boot and microservices questions that I have encountered recently , in next post I will try to create a post related to coding questions . Thanks and happy learning .

Other Spring Boot and Microservices articles yo may like:

--

--