注:以下内容收集自互联网。

SPRING 注解大全 60+32+48

web

mapping

  • @Mapping
  • @RequestMapping
  • @GetMapping
  • @PostMapping
  • @PutMapping
  • @DeleteMapping
  • @PatchMapping

rest

  • @RequestBody
  • @ResponseBody
  • @ResponseStatus
  • @RestController

统一处理

  • @ControllerAdvice
  • @ExceptionHandler
  • @RestControllerAdvice

参数

  • @RequestHeader
  • @CookieValue
  • @PathVariable
  • @RequestParam
  • @MatrixVariable
  • @RequestPart

转换与格式化

  • @DateTimeFormat
  • @NumberFormat
  • @InitBinder

validation

  • @Validated

scope

  • @ApplicationScope
  • @RequestScope
  • @SessionScope
  • @ModelAttribute
  • @RequestAttribute
  • @SessionAttribute
  • @SessionAttributes

ajax

  • @CrossOrigin

boot

auto

  • @AutoConfigurationPackage
  • @AutoConfigureAfter
  • @AutoConfigureBefore
  • @AutoConfigureOrder
  • @ImportAutoConfiguration
  • @SpringBootApplication
  • @EnableAutoConfiguration
  • @SpringBootConfiguration

condition

  • @ConditionalOnBean
  • @ConditionalOnClass
  • @ConditionalOnCloudPlatform
  • @ConditionalOnExpression
  • @ConditionalOnJava
  • @ConditionalOnJndi
  • @ConditionalOnMissingBean
  • @ConditionalOnMissingClass
  • @ConditionalOnNotWebApplication
  • @ConditionalOnProperty
  • @ConditionalOnResource
  • @ConditionalOnRepositoryType
  • @ConditionalOnSingleCandidate
  • @ConditionalOnWarDeployment
  • @ConditionalOnWebApplication

properties

  • @EnableConfigurationProperties
  • @ConfigurationProperties
  • @ConfigurationPropertiesBinding
  • @ConfigurationPropertiesScan
  • @ConstructorBinding
  • @DeprecatedConfigurationProperty
  • @NestedConfigurationProperty
  • @DefaultValue
  • @Name

convert

  • @DataSizeUnit
  • @Delimiter
  • @DurationFormat
  • @DurationUnit
  • @PeriodFormat
  • @PeriodUnit

其它

  • @DependsOnDatabaseInitialization
  • @EntityScan
  • @BatchDataSource
  • @FlywayDataSource
  • @LiquibaseDataSource
  • @QuartzDataSource
  • @QuartzTransactionManager
  • @JsonComponent
  • @LocalRSocketServerPort
  • @LocalServerPort
  • @ServletComponentScan

依赖注入

@Autowired

@Qualifier

@Value

@Lookup

缓存

@EnableCaching

@CacheConfig

@CacheEvict

@CachePut

@Cacheable

@Caching

组件扫描与配置类

@Component

@Controller

@Service

@Repository

@Indexed

@ComponentScan

  • @Filter

@ComponentScans

@Conditional

@DependsOn

@Description

@Configuration

@Bean

@Import

@ImportResource

@Lazy

@Primary

@Profile

@PropertySource

@PropertySources

@Role

@Scope

切面

@EnableAspectJAutoProxy

@EnableLoadTimeWeaving

@Configurable

事件、调度、异步

@EventListener

@TransactionalEventListener

@EnableAsync

@Async

@EnableScheduling

@Scheduled

@Schedules

核心

@AliasFor

@Order

监控

@EnableMBeanExport

@ManagedAttribute

@ManagedMetric

@ManagedNotification

@ManagedNotifications

@ManagedOperation

@ManagedOperationParameter

@ManagedOperationParameters

@ManagedResource

事务

@EnableTransactionManagement

@Transactional

lang

@NonNull

@NonNullApi

@NonNullFields

@Nullable

@UsesSunMisc