Overview

Components of the Spring Boot application are called beans. In simple words, bean is an object that managed by the Spring Boot IoC container. Such object lives in memory so long time as necessary. Only one instance will be created for every type. At nowadays the Java annotations are used for defining beans, early the xml files were used.

Servlet is a bean, that handles a client query, usually across HTTP. DispatcherServlet is a default servlet also socalled a front controller. It accepts all incoming request, searches a appropriate handler and returns response to user.

Each request is executed in its own thread. By default, the thread pool size is 200. This means that 200 requests are possible at the same time.

If requests have long time processing, you can optimize the code using asynchronous Spring Boot features or reactive programming using WebFlux. Obviously, in this case is assumed your API is a non-blocking API. Also you can manage data caching.

annotations

Below are the most useful Spring Boot annotations.

annotation description
@SpringBootApplication Defines an entry point of the spring boot application. This is also includes @SpringBootConfiguration, @EnableAutoConfiguration and @ComponentScan annotations.
@Controller Defines a servlet component, that handles http queries and produce html content.
@RestController Defines a controller component - servlet, that handles http queries and produce json content by default.
@Repository Indicates that a component implements DAO or just works with persistent storage.
@Service Indicates that a component doing some business logic.
@Component Indicates that a java class is a bean. @Component is base for other components like @Controller.
@Configuration Indicates that a java class can have a methods for creating beans (methods with @Bean annotation). Such classes are good place for implementing some configurations interfaces like WebMvcConfigurer.
@WebFilter Defines a filter that must implement javax.servlet.Filter interface. Filter is an object, that intercepts queries before handling by controller and/or before sending response to client.