3. Spring Boot Flashcards
(80 cards)
What is Spring Boot?
Spring Boot is an open-source Java-based framework used to create stand-alone, production-grade Spring-based applications. It simplifies the setup and development of new Spring applications.
What are the main features of Spring Boot?
The main features of Spring Boot include auto-configuration, standalone applications, production-ready features, microservices support, and a wide range of starter dependencies.
True or False: Spring Boot requires extensive XML configuration.
False. Spring Boot aims to minimize the need for XML configuration by using annotations and convention over configuration.
Fill in the blank: Spring Boot applications can be run as ______.
standalone Java applications.
What is the purpose of the @SpringBootApplication annotation?
@SpringBootApplication is a convenience annotation that combines @Configuration, @EnableAutoConfiguration, and @ComponentScan, enabling easier configuration of a Spring Boot application.
How does Spring Boot handle dependency management?
Spring Boot uses a dependency management feature that allows developers to easily manage dependencies and their versions via the Spring Boot Starter POMs.
What is a Spring Boot Starter?
A Spring Boot Starter is a set of convenient dependency descriptors that can be included in an application. They simplify the process of adding various features to the application.
What is the default port for a Spring Boot application?
The default port for a Spring Boot application is 8080.
What is the Spring Boot Actuator?
Spring Boot Actuator provides production-ready features such as monitoring and management capabilities for Spring Boot applications, including metrics, health checks, and application information.
What is the purpose of the application.properties file in Spring Boot?
The application.properties file is used to configure various properties of a Spring Boot application, such as server port, database configurations, logging levels, and more.
True or False: Spring Boot can be used to create RESTful web services.
True. Spring Boot is commonly used to create RESTful web services and APIs.
What is the role of the Spring Initializr?
Spring Initializr is a web-based tool that helps developers quickly generate a Spring Boot project structure with the necessary dependencies and configurations.
Explain the concept of auto-configuration in Spring Boot.
Auto-configuration is a feature in Spring Boot that automatically configures your application based on the dependencies present in the classpath. It reduces the need for manual configuration.
What is a Bean in Spring Boot?
A Bean is an object that is instantiated, assembled, and managed by the Spring IoC container. Beans are the backbone of a Spring application.
What is the difference between @Component, @Service, and @Repository annotations?
@Component is a generic stereotype for any Spring-managed component. @Service is a specialization of @Component for service layer components, and @Repository is a specialization for data access layer components.
What does the @RestController annotation do?
@RestController is a convenience annotation that combines @Controller and @ResponseBody, indicating that the methods in the class will return data instead of views.
What is Spring Boot DevTools?
Spring Boot DevTools provides additional development-time features such as automatic restarts, live reload, and configurations for improved development experience.
How can you create a Spring Boot application?
You can create a Spring Boot application using Spring Initializr, by selecting dependencies, generating the project, and then importing it into your IDE.
What is the purpose of the @Configuration annotation?
@Configuration is used to indicate that a class contains Spring configuration. It can define beans and their dependencies.
What is the Spring Boot CLI?
The Spring Boot CLI (Command Line Interface) is a tool that allows you to run and test Spring Boot applications from the command line using Groovy scripts.
What is the significance of the @Value annotation?
@Value is used to inject values into fields from property files or environment variables, allowing for externalized configuration of Spring applications.
What is Spring Data JPA?
Spring Data JPA is a part of the Spring Data project that simplifies data access and manipulation using Java Persistence API (JPA) and provides a repository abstraction.
Explain the concept of profiles in Spring Boot.
Profiles in Spring Boot allow you to segregate parts of your application configuration and make it only available in certain environments, such as development, testing, and production.
What is the purpose of the @Autowired annotation?
@Autowired is used for automatic dependency injection, allowing Spring to resolve and inject collaborating beans into your bean.