Tuesday, April 9, 2019

Spring Framework Annotations

Core Spring Framework Annotations

  • @Required
  • @Autowired
  • @Qualifier
  • @Bean
  • @Lazy
  • @Value


Spring Framework Stereotype Annotations

  • @Component
  • @Controller
  • @Repository
  • @Service


Spring Boot Annotations

  • @EnableAutoConfiguration
  • @SpringBootApplication = @Configuration + @EnableAutoConfiguration + @ComponentScan

Spring MVC and REST Annotations

  • @Controller
  • @RequestMapping
  • @CookieValue
  • @CrossOrigin


Composed @RequestMapping Variants

  • @GetMapping
  • @PostMapping
  • @PutMapping
  • @PatchMapping
  • @DeleteMapping
  • @ExceptionHandler
  • @InitBinder
  • @Mappings and @Mapping
  • @MatrixVariable
  • @PathVariable
  • @RequestAttribute
  • @RequestBody
  • @RequestHeader
  • @RequestParam
  • @RequestPart
  • @ResponseBody
  • @ResponseStatus
  • @ControllerAdvice
  • @RestController = @Controller + @ResponseBody
  • @RestControllerAdvice = @ControllerAdvice + @ResponseBody
  • @SessionAttribute
  • @SessionAttributes

Spring Cloud Annotations

  • @EnableConfigServer
  • @EnableEurekaServer
  • @EnableDiscoveryClient
  • @EnableCircuitBreaker
  • @HystrixCommand



Spring Framework DataAccess Annotations

  • @Transactional

Cache-Based Annotations
  • @Cacheable : To add data into cache
  • @CachePut : To update data into cache while update into database
  • @CacheEvict : To delete data from cache while deleting from database
  • @CacheConfig : To configure cache

Task Execution and Scheduling Annotations

  • @Scheduled
  • @Async

Spring Framework Testing Annotations

  • @BootstrapWith
  • @ContextConfiguration
  • @WebAppConfiguration
  • @Timed
  • @Repeat
  • @Commit
  • @RollBack
  • @DirtiesContext
  • @BeforeTransaction
  • @AfterTransaction
  • @Sql
  • @SqlConfig
  • @SqlGroup
  • @SpringBootTest
  • @DataJpaTest
  • @DataMongoTest : To embedded MongoDB for running integration tests with Spring Data MongoDB.
  • @WebMVCTest
  • @AutoConfigureMockMVC
  • @MockBean
  • @JsonTest
  • @TestPropertySource



1 comment: