Some common annotations used in spring eco system

Spring Annotations

Package

Annotation

Description

org.springframework.stereotype

@Component

org.springframework.stereotype

@Controller

org.springframework.stereotype

@Service

org.springframework.stereotype

@Repository

org.springframework.context.annotation

@ComponentScan

org.springframework.context.annotation

@ComponentScans

org.springframework.context.annotation

@Bean

org.springframework.context.annotation

@Configuration

org.springframework.context.annotation

@Scope

org.springframework.context.annotation

@Lazy

org.springframework.context.annotation

@DependsOn

org.springframework.context.annotation

@Primary

org.springframework.context.annotation

@Profile

org.springframework.context.annotation

@Import

org.springframework.context.annotation

@ImportResource

org.springframework.context.annotation

@Conditional

org.springframework.context.annotation

@PropertySource

org.springframework.context.annotation

@PropertySources

org.springframework.beans.factory.annotation

@Autowired

org.springframework.beans.factory.annotation

@Value

org.springframework.beans.factory.annotation

@Qualifier

org.springframework.beans.factory.annotation

@Lookup

org.springframework.cache.annotation

@EnableCaching

org.springframework.cache.annotation

@CacheConfig

org.springframework.cache.annotation

@Cacheable

org.springframework.cache.annotation

@CacheEvict

org.springframework.cache.annotation

@CachePut

org.springframework.cache.annotation

@Caching

org.springframework.web.bind.annotation

@RestController

org.springframework.web.bind.annotation

@RequestMapping

org.springframework.web.bind.annotation

@GetMapping

org.springframework.web.bind.annotation

@PostMapping

org.springframework.web.bind.annotation

@PutMapping

org.springframework.web.bind.annotation

@DeleteMapping

org.springframework.web.bind.annotation

@PatchMapping

org.springframework.web.bind.annotation

@RequestPart

org.springframework.web.bind.annotation

@RequestParam

org.springframework.web.bind.annotation

@PathVariable

org.springframework.web.bind.annotation

@RequestAttribute

org.springframework.web.bind.annotation

@RequestHeader

org.springframework.web.bind.annotation

@RequestBody

org.springframework.web.bind.annotation

@ResponseBody

org.springframework.web.bind.annotation

@ResponseStatus

org.springframework.web.bind.annotation

@CrossOrigin

org.springframework.web.bind.annotation

@ExceptionHandler

org.springframework.web.bind.annotation

@ControllerAdvice

org.springframework.web.bind.annotation

@RestControllerAdvice

org.springframework.validation.annotation

@Validated

Spring Test Annotations

Spring Boot Annotations

Package

Annotation

Description

org.springframework.boot.autoconfigure

@SpringBootApplication

org.springframework.boot.autoconfigure

@EnableAutoConfiguration

org.springframework.boot

@SpringBootConfiguration

org.springframework.boot.autoconfigure

@AutoConfiguration

org.springframework.boot.autoconfigure

@AutoConfigureBefore

org.springframework.boot.autoconfigure

@AutoConfigureAfter

org.springframework.boot.autoconfigure

@AutoConfigurationPackage

org.springframework.boot.autoconfigure

@AutoConfigureOrder

org.springframework.boot.autoconfigure

@ImportAutoConfiguration

org.springframework.boot.autoconfigure.condition

@ConditionalOnBean

org.springframework.boot.autoconfigure.condition

@ConditionalOnClass

org.springframework.boot.autoconfigure.condition

@ConditionalOnExpression

org.springframework.boot.autoconfigure.condition

@ConditionalOnMissingBean

org.springframework.boot.autoconfigure.condition

@ConditionalOnProperty

org.springframework.boot.autoconfigure.condition

@ConditionalOnSingleCandidate

org.springframework.boot.autoconfigure.condition

@ConditionalOnResource

Spring Boot Test Annotations

Jakarta Annotations

Dependency Injection

Package

Annotation

Description

jakarta.annotation

@PostConstruct

jakarta.annotation

@PreDestroy

Bean Validation

Package

Annotation

Description

AOP Annotations

Package

Annotation

Description

org.aspectj.lang.annotation

@Aspect

org.aspectj.lang.annotation

@Pointcut

org.aspectj.lang.annotation

@Before

org.aspectj.lang.annotation

@After

org.aspectj.lang.annotation

@AfterReturning

org.aspectj.lang.annotation

@AfterThrowing

org.aspectj.lang.annotation

@Around

References

Last updated