`
rensanning
  • 浏览: 3518225 次
  • 性别: Icon_minigender_1
  • 来自: 大连
博客专栏
Efef1dba-f7dd-3931-8a61-8e1c76c3e39f
使用Titanium Mo...
浏览量:37579
Bbab2146-6e1d-3c50-acd6-c8bae29e307d
Cordova 3.x入门...
浏览量:604650
C08766e7-8a33-3f9b-9155-654af05c3484
常用Java开源Libra...
浏览量:678516
77063fb3-0ee7-3bfa-9c72-2a0234ebf83e
搭建 CentOS 6 服...
浏览量:87540
E40e5e76-1f3b-398e-b6a6-dc9cfbb38156
Spring Boot 入...
浏览量:400045
Abe39461-b089-344f-99fa-cdfbddea0e18
基于Spring Secu...
浏览量:69129
66a41a70-fdf0-3dc9-aa31-19b7e8b24672
MQTT入门
浏览量:90644
社区版块
存档分类
最新评论

Spring 注解大全

 
阅读更多
Spring项目中会用到大量的注解,这里罗列以下常用的。除过这些外SpringBoot、SpringSecurity、SpringData等也有大量的注解。

可以通过package去查看官方文档里的具体说明,比如:
http://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/context/annotation/package-summary.html
Annotation Types Summary部分就是该package下所有注解的说明。


(1)Context org.springframework.context.annotation
@Configuration
@ComponentScan
@ComponentScans
@Conditional
@Bean
@Lazy
@DependsOn
@Import
@ImportResource
@Primary
@Profile
@Scope
@Description
@PropertySource
@PropertySources
@Role

(2)Bean org.springframework.beans.factory.annotation
@Autowired
@Qualifier
@Required
@Scope
@Lookup
@Value
@Configurable

(3)Core org.springframework.core.annotation
@Order
@AliasFor

(4)Stereotyping org.springframework.stereotype
@Component
@Controller
@Service
@Repository

(5)Web org.springframework.web.bind.annotation
@Controller
@ControllerAdvice
@InitBinder
@ModelAttribute
@MatrixVariable
@RequestMapping
@RequestParam
@RequestPart
@RequestBody
@RequestHeader
@RequestAttribute
@SessionAttribute
@SessionAttributes
@CookieValue
@ExceptionHandler
@CrossOrigin

@GetMapping
@PostMapping
@PutMapping
@DeleteMapping
@PatchMapping

@RestController
@RestControllerAdvice
@ResponseBody
@ResponseStatus
@PathVariable

(6)Transaction org.springframework.transaction.annotation
@EnableTransactionManagement
@Transactional

(7)Cache org.springframework.cache.annotation
@EnableCaching
@CacheConfig
@Cacheable
@Caching
@CachePut
@CacheEvict

(8)Schedule org.springframework.scheduling.annotation
@EnableAsync
@Async
@EnableScheduling
@Scheduled
@Schedules

(9)Aspect org.aspectj.lang.annotation
@Aspect
@After
@AfterReturning
@AfterThrowing
@Around
@Before
@DeclareParents
@Pointcut

(10)JSR-250 javax.annotation
@PostConstruct
@PreDestroy
@Resource

(11)JSR-330 javax.inject
@Inject
@Named

(12)JSR-303 javax.validation.constraints
@Max
@Min
@NotNull
@Size
@Pattern
@Valid

Hibernate Validator org.hibernate.validator.constraints
@Email
@Length
@Digits
@NotEmpty
@NotBlank
@Range
@URL
@Past
@Future

(13)MyBatis org.apache.ibatis.annotations
@Param
@Select
@Update
@Delete
@Insert
@Results
@Result
@Options

(14)其他
@EnableWebMvc org.springframework.web.servlet.config.annotation
@Validated org.springframework.validation.annotation
@MapperScan org.mybatis.spring.annotation
@Alias org.apache.ibatis.type.Alias



https://dzone.com/articles/15-spring-core-annotations-with-examples

参考:
https://dzone.com/refcardz/spring-annotations
  • 大小: 47.2 KB
  • 大小: 21.1 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics