Spring Boot - Level V (Expert) Interview Questions
Spring Boot Level V contains expert questions for lead and architect roles, many drawn from real project experience. They cover designing REST APIs from scratch, caching strategies, custom exception-handling frameworks, custom starters, verifying production deployments, storing artifacts and Docker images, containerizing applications, Kafka integration and the CAP theorem.
- Name five annotations you use to build a REST API in Spring Boot.
- Have you seen real-world bugs caused by choosing PUT instead of POST (or the reverse)? How were they fixed?
- If you have multiple beans of the same type in your Spring application context, how would you handle conflicts using @Autowired and @Qualifier? What potential issues could arise if you mix these annotations incorrectly?
- If your application needs to handle file uploads, which controller would you prefer and why? Can you describe a scenario where using a @RestController could lead to complications?
- Do you use caching? In which scenarios, and when do you remove or refresh cached data?
- Assume your cache is stale due to frequent updates in the underlying data source. How would you determine when to refresh the cache, and what strategies would you use to ensure minimal disruption to users?
- How do you verify your changes after they are deployed to production?
- If you discover a critical bug shortly after deployment, what processes do you have in place to roll back the changes quickly and safely?
- Where do you store your build artifacts?
- If your artifact storage becomes inaccessible, what contingency plans do you have to ensure your deployment process can continue?
- What is the CAP theorem?
- Can you provide a real-world scenario where you had to prioritize between consistency, availability, and partition tolerance? What decision did you make?
- Describe a time when a misconfigured properties file caused a production issue.
- Consider a scenario where a transaction spans multiple service calls. How would you decide the appropriate propagation level for each service call, and what potential pitfalls could arise with your chosen approach?
- What are the best practices for designing a custom exception handling framework in Spring Boot?
- How do you manage configuration changes for your Dockerized Spring Boot application across different environments (development, testing, production)?
- As part of a move to a microservices architecture, you are tasked with containerizing your Spring Boot applications using Docker. What are the steps to prepare your Spring Boot application for Docker, and what best practices would you follow?
- How can you customize Spring Boot Actuator to report health metrics specific to your application?
- You need to integrate Kafka to handle real-time notifications in a social media application built with Spring Boot. How would you set up and configure this integration?
- How do you make sure a custom starter doesn't interfere with Spring Boot's own auto-configuration?
- You're tasked with creating a custom starter for handling cloud-based message queuing in multiple microservices across your organization. What key components will you include in your starter?
- Suppose you need to ensure zero downtime deployments for a Spring Boot e-commerce application. What approach would you take?
- What are the basic commands to build a Docker image, and where do you store Docker images?
- What is Spring Cloud Sleuth used for, and what replaces it in Spring Boot 3?
- What is Micrometer Tracing in Spring Boot 3?
- How do you enable and disable auto-configuration in Spring Boot?
- What are traceId and spanId in Spring Boot microservices, and what are they used for?
- What are WebFlux and Mono in Spring Boot?
- How do you create a custom annotation in Java?
- How do you resolve two ambiguous URL mappings in Spring Boot without changing the HTTP method or the URL?