Complete example of @Autowired,@Service,@Component and @RestController Example Session 5

preview_player
Показать описание
Click the below link to download the latest Billing System Source code.
More information about the Billing System Project. Watch this video

Using @Service and @Component class you are saying that a particular class is a Service class or component class. At the time of starting the server, @ComponentScan annotation search all classes annotated with @Service or @Component Annotation and deploy those classes in Spring's IOC container. once all classes created in the IOC container, we are ready to use those classes anywhere in our application using @Autowired Annotation. Using @Autowired you are initializing the particular Service or Component class in the other Java class without using a new operator. Managing Initializing new classes and destroying already initialized classes are taken care of by Spring Boot IOC container.
Using @ResController we are saying that a particular class is the Rest Service class. Once you annotated @RestController, you are ready to add the service endpoint method in the class using @RequestMapping Annotation or @GetMapping or @PostMapping etc.

I have posted all technical related topics on the following site. Please check it out

If you want to only Billing-System-related Technical Topics, please go to the following link.

Click the below link to download the latest Billing System code.

All Billing System-related videos update in the following post

#springbootforbeginners #springbootintroduction,#springboottutorial #springbootbasics

#springbootforbeginners #springbootintroduction #springboottutorial #springbootbasics
Рекомендации по теме