Springboot Flashcards
What is Springboot?
An open-source framework that simplifies the creation and development of web-based applications in Java
Allows developers to focus on writing business logic, rather than configuration
Provides pre-configured components, opinionated defaults, and a command-line interface that facilitates the creation of production-ready applications.
What is the difference between Spring and Springboot?
Spring Boot is a more streamlined version of Spring that simplifies the configuration process and provides an out-of-the-box experience
Spring is a more modular and customizable framework that provides a wider range of features but requires more configuration.
What is the default port used by SpringBoot?
8080
What are the advantages of using Spring Boot?
- simplified configuration
- auto configuration
- faster development
- out of the box experience
- easy configuration
- large community support
What is a Bean in Spring Boot?
An object
How do you create a RESTful web service using SpringBoot?
- Create a new Spring Boot project using your preferred IDE or by using Spring Initializr.
- Add the necessary dependencies to your project, including spring-boot-starter-web.
- Create a new Java class that will serve as the REST controller. This class should be annotated with @RestController.
- Define methods within the controller class that will handle HTTP requests from clients. These methods should be annotated with the appropriate HTTP method annotation (e.g., @GetMapping, @PostMapping, @PutMapping, @DeleteMapping).
- Define the URI mappings for the methods using the @RequestMapping annotation.
- Define the response types for the methods, which can be a simple data type (e.g., String) or a custom class.
- Run the Spring Boot application, and the RESTful web service will be available at the specified URI.
What is an application.properties file in Spring Boot?
- Port number
- Database connection
What is a DTO?
A data transfer object is a design pattern that lets us transfer a group of info at one time
Ie. instead of fetching info about customers one at a time, you could make a class
customer DTO {
setFirstName..
setSecondName..
}