Spring Boot Annotation :
1.@SpringBootApplication: This is the main annotation used to mark the main class of a Spring Boot application. It combines the functionality of @Configuration, @EnableAutoConfiguration, and @ComponentScan.
2.@RestController: This annotation is used to define a RESTful controller class. It combines @Controller and @ResponseBody annotations.
3.@RequestMapping: This annotation is used to map HTTP requests to specific handler methods within a controller class. It can be applied at both the class and method levels.
4.@PathVariable: This annotation is used to bind a method parameter to a path variable in a request URL.
5.@RequestParam: This annotation is used to bind a method parameter to a query parameter or form data in a request URL.
6.@RequestBody: This annotation is used to bind the request body to a method parameter. It is commonly used for handling JSON or XML payloads in requests.
6.@Autowired: This annotation is used to automatically wire dependencies by type. It can be applied to fields, constructor parameters, or setter methods.
7.@Service: This annotation is used to mark a class as a service component. It is typically used in the service layer of an application.
8.@Repository: This annotation is used to mark a class as a data access component or repository. It is typically used in the persistence layer of an application.
9.@Configuration: This annotation is used to define a class as a configuration class that provides bean definitions.
10.@EnableAutoConfiguration: This annotation is used to enable Spring Boot's auto-configuration mechanism.
11.@ComponentScan: This annotation is used to enable component scanning to automatically detect and register beans within the specified base packages.
12.@ConditionalOnProperty: This annotation is used to conditionally enable or disable a component based on the presence or value of a specific property.
13.@Validated: This annotation is used to enable bean validation on a class or method.
14.@EnableScheduling: This annotation is used to enable scheduling capabilities in Spring Boot, allowing the use of @Scheduled annotations.
15.@Transactional: Marks a method, class, or interface as transactional, enabling transaction management.
16.@Cacheable: Enables method-level caching to cache the results of a method.
17.@EnableCaching: Enables Spring's caching infrastructure.
18.@ExceptionHandler: Handles exceptions thrown within a controller, allowing custom error handling.
19.@Value: Injects values from properties files or environment variables into variables or fields.
20.@Qualifier: It is used to solve ambiguous problems.
21.@Profile: It allows you to specify which beans should be activated or deactivated based on the active profiles set in your application.
22.@ControllerAdvice: It is used to define global exception handling and apply it to multiple controllers.
23.@Bean: It is used to explicitly declare a bean definition in a configuration class. It is typically used in conjunction with @Configuration to define beans manually instead of relying on component scanning.
0 Comments