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
分享到:
相关推荐
spring注解大全
Spring注解大全和解释 组合注解(组合了@Component注解),应用在MVC层(控制层),DispatcherServlet会自动扫描注解了此注解的类,然后将web请求映射到注解了@RequestMapping的方法上等
应用在MVC层(控制层)DispatcherServlet会自动扫描注解了此注解的类,然后将web请求映射到注解了RequestMapping的方法上。Service 组合注解(组合了@Component注解),应用在service层(业务逻辑层)
spring注解描述大全
常用的spring注解大全,适合新手学习、老手温故知新。读懂spring,平步青云。
Spring注解大全,注解整理方式采用思维导图工具(XMind)整理,对注解按自己的方式进行了分类,并对所有的注解在备注中进行了解释说明;
该文档记录了spring框架常用的注解和其他内容,需要的可以自己下载!
Spring注解
spring注解笔记spring注解笔记spring注解笔记spring注解笔记
Spring注解注入属性
Spring demo 自动检测注解
spring 注解
Spring注解描述,底层笔记
要学习hibernate注解和spring注解的,可以下载, 该工程包括了hibernate注解和spring注解做的登录例子
Spring注解所依赖的包。com.springSource.javax.annotation
注解和注释以及Spring和SpringMVC常用的注解 1.两者区别 注解 :参与代码编译,以@开头的。它是给应用程序看的,单独使用注解毫无意义,一定要跟工具一起使用,这个所谓的工具实际就是能读懂注解的应用程序 注释 :...
Spring注解驱动开发.pdf
spring 注解 aop demo spring 注解 aop demo spring 注解 aop demo spring 注解 aop demo
《Spring注解驱动开发》是一套帮助我们深入了解Spring原理机制的教程; 现今SpringBoot、SpringCloud技术非常火热,作为Spring之上的框架,他们大量使用到了Spring的一些底层注解、原理,比如@Conditional、@Import...