Spring_Boot_Interview_Questions_and_Answers
Spring_Boot_Interview_Questions_and_Answers
Q: What is Spring Boot and how does it differ from Spring Framework?
A: Spring Boot is an extension of the Spring Framework that simplifies the setup, configuration, and
deployment of Spring applications. It provides defaults and reduces boilerplate code by using
auto-configuration, and scans for components, simplifying the setup of a Spring Boot application.
production-ready features (like metrics and health checks), and easy dependency management.
A: Spring Boot provides a curated list of dependencies through starter POMs that bring in commonly
A: An Application Context is a central interface in the Spring Framework that provides configuration
information to the application. It manages the lifecycle of beans and provides dependency injection.
A: Dependency injection in Spring Boot is facilitated through annotations like @Autowired, which
applications without needing to deploy them to an external server, simplifying the development and
deployment process.
Q: What is a microservice, and how does Spring Boot facilitate microservice development?
coupled services. Spring Boot simplifies microservices development by providing a set of tools and
A: Both interfaces allow execution of code after the Spring application has started.
simpler version.
service layer components, @Repository is for data access components, and @Controller is for web
controllers.
A: @Autowired is used for automatic dependency injection. It supports constructor injection, setter
A: @RequestMapping is used to map web requests to specific handler methods. It supports various
HTTP methods like GET, POST, PUT, DELETE, etc.
while @Component is used for class-level scanning. Use @Bean when you need custom
instantiation logic.
A: @Value is used to inject values from property files into Spring beans, allowing for externalized
configuration.