
Explore the @Component annotation that marks a class as a spring bean and tells the spring container to automatically create and manage that bean in annotation-based configuration.
The autowired annotation automatically injects a spring bean using constructor, setter, or field injection, demonstrated by injecting a veg pizza bean into a pizza controller.
Use the qualifier annotation to tell the spring container which bean to inject when an interface has multiple implementations, such as veg pizza or non-veg pizza.
Use the @Primary annotation to give higher priority to a bean when multiple Spring beans implement the same type, enabling unambiguous injection.
Explore how @Bean creates spring beans in a java-based configuration and how @Configuration marks a configuration class. Learn to define beans, inject dependencies, and use initMethod and destroyMethod for lifecycle.
Learn how stereotype annotations, derived from component, auto-create Spring beans in the three-layer architecture—controller, service, and repository—within a Spring container, using @Controller, @Service, and @Repository.
Learn how Spring eagerly creates beans at application context startup and how @Lazy loads beans on demand, shown with eager and lazy loader examples.
Bind external configurations to a strongly typed string bean using the configuration properties annotation, including nested objects, maps, and a prefix in a Spring Boot application.
Explore how the @Controller and @ResponseBody annotations turn a Java class into a Spring MVC controller, enable request handling with @RequestMapping, and return JSON responses via HTTP.
Discover how the rest controller annotation acts as a shortcut that replaces at controller and at response body annotations to build RESTful services with Spring MVC.
Map web requests to Spring controller methods using the @RequestMapping annotation, configuring base URLs, class- and method-level mappings, multiple URLs, HTTP methods, and producers and consumes attributes.
Learn how the get mapping annotation is a shortcut for request mapping plus http get, map single or multiple urls using the value attribute, and control media types like application/json.
Use @PostMapping and @RequestBody to map http post requests, consume json via application/json, and convert it to a Java object; test with Postman and verify http status 201.
Learn how the @PutMapping annotation maps HTTP put requests to a handler. Use it as a shortcut for @RequestMapping with method put to update a book.
Explain how the delete mapping annotation acts as a shortcut for add request mapping with http delete. Show binding the template variable to the method parameter with a path variable.
In this course, I will cover the following 20+ spring and spring boot annotations with line-by-line coding in IntelliJ IDEA. We gonna use the latest version of Spring Boot 3 and Java 17.
These 20+ annotations are frequently asked in interviews for beginners so I highly recommend going through these annotations before an interview.
Spring and Spring Boot Annotations:
Component Annotation
Autowired Annotation
Qualifier Annotation
Primary Annotation
SpringBootApplication
Bean and Configuration Annotations
Controller, Service, and Repository
Lazy Annotation
Scope Annotation
Value Annotation
PropertySource and PropertySources Annotations
ConfigurationProperties Annotation
Controller and ResponseBody Annotations
RestController Annotation
RequestMapping Annotation
GetMapping Annotation
PostMapping and RequestBody Annotations
PutMapping Annotation
DeleteMapping Annotation
PathVariable Annotation
RequestParam Annotation
What is Spring Framework?
Spring Framework is a popular open-source Java-based application framework that provides a comprehensive infrastructure for developing Java applications. It was initially created to simplify the development of enterprise applications, but it has since expanded to become a general-purpose framework for developing any kind of Java application.
What is Spring Boot?
Spring Boot is basically an extension of the Spring framework which eliminates the boilerplate configurations required for setting up a Spring application.
Spring Boot is an opinionated framework that helps developers build Spring-based applications quickly and easily. The main goal of Spring Boot is to quickly create Spring-based applications without requiring developers to write the same boilerplate configuration again and again.
Tools and technologies used:
- Spring Boot 3
- Java 17 or later
- IntelliJ IDEA
- Maven
- Postman