UNCLOB
UNCLOB
Angular Spring Boot
UNCLOB

SpringBoot – Core Annotations

  1. @configuration - Used to mark a class as source of Bean Definition, beans are the component that we need to wire.
  2. @Bean- This annotation is a bean producer, used along with @configuration annotation.
  3. @componentScan- Scan for the spring packages configured with it for @configuration classes.
  4. @Component - Used for making a class as Spring Bean at auto - scan time.
  5. @Service- More specialized annotation of @component annotation.
  6. @Repository- Used for DAO operations and establishing the connection with database, also to handled postDataProcessorException.
  7. @Autowire- This annotation helps in binding the already available spring bean instance in the calling class via automatic dependency injection, condition that both the classes should have to be beans i.e., both beans should have to live in application context.
    • @Autowire annotation can be used over - field, constructor, and methods.
    • @Autowire searches the bean by type.
  8. @Qualifier- There may be a situation when you create more than one bean of the same type and want to wire only one of them with a property. In such cases, you can use the@Qualifier annotation along with @Autowired to remove the confusion by specifying which exact bean will be wired.
  9. @Qualifier searches the bean by name.
  10. @Required - if dependency injection need to be verified while wiring the bean using @Autowire annotation in more robust way, @Required annotation is best to use. When using @Required annotation if injected bean not found then exception will get occur.
  11. @Lazy - Used for Lazy initialization or OnDemand initialization. By default, bean initialization is eager.
  12. @Repository- Used for DAO operations and establishing the connection with database, also to handled postDataProcessorException.
  13. @Repository- Used for DAO operations and establishing the connection with database, also to handled postDataProcessorException.
  14. @Repository- Used for DAO operations and establishing the connection with database, also to handled postDataProcessorException.
  15. @value - can be used to set the default value of a field.
  16. @Valid – Used for validating the request payload fields for Domain object parameters specific validation such as @NotNull, @NotBlank, @Size, @Min, @Max etc.

Note: - Spring makes application loosely coupled using Dependency Injection. Dependency Injection is an implementation of the Inversion of Control principle.

SpringBoot – Web Annotations

  1. @SpringBootApplication - combination of (@configuration, @componentScan, @EnableAutoConfiguration).
  2. @EnableAutoConfiguration - it helps Spring to guess configuration based on jars available at class path.
  3. Controller - mark the class as web controller and handles the http requests.
  4. @ResponseBody - helps in binding the response for an incoming http request.
  5. @RestController - combination of @Controller and @ResponseBody annotations.
  6. @RequestMapping(method = RequestMethod.Type, value = "/path") - used to get the path responsible for serving the Http requests.
  7. @PathVariable("placeHolderName") - used to bring the value from URL via '/' to the method argument.
  8. @RequestParam/ @RequestParam(value = "value", required = false) - used to bring the value from URL via '?' or queries passed in the http requests to the method argument.
  9. @ExceptionHandler - It is a Spring annotation that provides a mechanism to treat exceptions that are thrown during execution of handlers (Controller operations). This annotation, if used on methods of controller classes, will serve as the entry point for handling exceptions thrown within this controller only.
  10. @ControllerAdvice - It is used to enable a single @ExceptionHandler to be applied to multiple controllers or controller methods. The most common way is to use @ExceptionHandler on methods of @ControllerAdvice classes so that the exception handling will be applied globally or to a subset of controllers.
  11. @GetMapping .
  12. @PostMapping .
  13. @PutMapping .
  14. @DeleteMapping

UNCLOB