Spring Boot
Explore the core concepts of Spring Boot including dependency management, embedded servers, and starter projects. Understand how to create, configure, and deploy Spring Boot applications efficiently using tools like Spring Initializr and auto-configuration. Discover how to manage external configurations, customize actuator endpoints, and use DevTools to boost development productivity.
We'll cover the following...
- What is Spring Boot?
- Why do we need Spring Boot?
- How can a Spring Boot application be created?
- What is Spring Initializr?
- What are the components of Spring Boot?
- What is the purpose of the @SpringBootApplication annotation?
- What is the purpose of the @RestController annotation in Spring Boot?
- What is the purpose of the @ConditionalOnMissingBean annotation?
- What is an embedded server in Spring Boot?
- Can we change the default embedded server to Jetty?
- How are Spring Boot web applications deployed?
- What is Spring Boot dependency management?
- What happens when a web application is run using Spring Boot?
- How can the default port of the embedded tomcat server be changed?
- How can the default web server in a Spring Boot application be disabled?
- What are Spring Boot starter projects?
- What is spring-boot-starter-parent?
- Can Spring Boot be used for applications not built using the Spring framework?
- How can we connect Spring Boot with databases?
- What does the exclude attribute of the @SpringBootApplication do?
- How can external configuration be done in Spring Boot?
- What is a Spring Actuator?
- How can the Actuator be accessed in Spring Boot?
- How can you create custom endpoints in Spring Boot Actuator?
- Explain Spring Boot DevTools.
What is Spring Boot?
Spring Boot is a project that contains a pre configured set of dependencies for different projects which aims at reducing the time for application configuration. It allows a developer to set up a running Spring application with a small amount of code.
Why do we need Spring Boot?
Spring Boot minimizes boilerplate code. It has a predefined set of dependencies and their versions which work together. Spring Boot autoconfigures the dependencies making the developers task easier. It helps kick-start the development process.
Since it comes with an embedded server, there is no need to deploy WAR files.
How can a Spring Boot application be created?
There are various ways on which a Spring Boot application can be created.
- Using Spring Initializr
- Spring Boot CLI
- Spring Tools Suite (STS)
What is Spring Initializr?
Spring Initializr is a web tool on the official Spring site. It asks for the project details and then configures all dependencies based on the project requirements to create a working project that is available for download.
What are the components of Spring Boot?
The core components of Spring Boot are:
- Spring Boot Starters: a set of pre configured dependencies that help kick start a project.
- Spring Boot AutoConfiguration: provide configuration for functionality common to many Spring applications.
- Spring Boot CLI: allows running and testing a Spring Boot application from the command prompt.
- Spring Boot Actuator: provides metrics about application’s performance.
What is the purpose of the @SpringBootApplication annotation?
The @SprignBootApplication is used to launch the application context. It is a conglomeration of three annotations.
This annotation is used on the main class of a Spring Boot application.
What is the purpose of the @RestController annotation in Spring Boot?
The ...