Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

What are spring boot-service components in spring boot?


Asked by Andrea Peters on Dec 12, 2021 Spring



Spring Boot - Service Components. Service Components are the class file which contains @Service annotation. These class files are used to write business logic in a different layer, separated from @RestController class file. Observe that in this tutorial, we are using Product Service API(s) to store, retrieve, update and delete the products.
In fact,
A service is similar to a component in that it’s used by foreign applications. The main difference is that I expect a component to be used locally (think jar file, assembly, dll, or a source import).
Subsequently, Spring Boot is a Framework from “The Spring Team” to ease the bootstrapping and development of new Spring Applications. It provides defaults for code and annotation configuration to quick start new Spring projects within no time.
Additionally,
Spring @Service annotation is a specialization of @Component annotation. Spring Service annotation can be applied only to classes. It is used to mark the class as a service provider. Spring @Service annotation is used with classes that provide some business functionalities.
Moreover,
Spring Boot @SpringBootApplication annotation is used to mark a configuration class that declares one or more @Bean methods and also triggers auto-configuration and component scanning. It’s same as declaring a class with @Configuration, @EnableAutoConfiguration and @ComponentScan annotations.