© Marten Deinum 2018
Marten DeinumSpring Boot 2 Recipeshttps://doi.org/10.1007/978-1-4842-3963-6_2

2. Spring Boot—Basics

Marten Deinum1 
Meppel, Drenthe, The Netherlands

In this chapter we will take a look at the basic features of Spring Boot.


To get a starting point, use the Spring Initializr to create a project. No additional dependencies are required, just a Spring Boot project.

2.1 Configure a Bean


You want Spring Boot to use your class as a bean.


Depending on your needs, you can either leverage @ComponentScan to automatically detect your class and have an instance created; use it together with @Autowired and @Value to get dependencies or properties injected; or you can use a method annotated with @Bean to have more control ...

Get Spring Boot 2 Recipes: A Problem-Solution Approach now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.