常用注解:Java、Spring框架
Java 8
Spring Framework/Boot/Web
--
Java中的注解【很神奇】。ben发布于博客园
虽然用过很多,但是,对其感知仍然模糊,应该是对它们的使用原理不清楚所致。
本文仅整理一些自己常用的 注解:名称、所在位置等信息。
1、JDK的
rt.jar 包
ben发布于博客园
元注解:java.lang.annotation
| @Target |
| @Retention |
| @Document |
| @Inherited |
| @Repeatable |
| @Native |
标准注解:java.lang
| @Override |
| @Deprecated |
| @SuppressWarnings |
| @FunctionalInterface |
| @SafeVarargs |
ben发布于博客园
javax下的注解:javax.annotation
| @Resource |
| @Resources |
| @Generated |
| @PostConstruct |
| @PreDestroy |
ben发布于博客园
2、Spring Framework的
Spring Framework 由哪些 jar包 组成呢?
- spring-core
- spring-context
- spring-beans
- spring-aop
- spring-expression
- 等等 TODO
spring-core: org.springframework.core.annotation
| @AliasFor |
| @Order |
spring-beans: org.springframework.beans.factory.annotation
| @Autowired |
| @Qualifier |
| @Value |
ben发布于博客园
spring-context: org.springframework.stereotype
| @Indexed |
| @Component |
| @Controller |
| @Service |
| @Repository |
ben发布于博客园
spring-context: org.springframework.context.annotation
| @Import @ImportResource |
| @Bean |
| @ComponentScan @ComponentScan#@Filter @ComponentScans |
| @Configuration |
| @Lazy |
| @Primary |
| @Profile |
| @PropertySource @PropertySources |
| @Conditional |
ben发布于博客园
spring-context: org.springframework.scheduling.annotation
| @Async |
| @EnableAsync |
| @Scheduled |
| @EnableScheduling |
| @Schedules |
3、Spring Web的
Web服务开发相关的注解整理。
ben发布于博客园
spring-web: org.springframework.web.bind.annotation
| @RestController @RestControllerAdvice |
| @ControllerAdvice |
| @CrossOrigin |
| @ExceptionHandler |
| @Mapping @RequestMapping @GetMapping @PostMapping @DeleteMapping @PatchMapping @PutMapping |
| @PathVariable @RequestBody @RequestHeader @RequestParam @RequestPart |
| @CookieValue |
| @SessionAttribute @SessionAttributes |
ben发布于博客园
4、Spring Boot的
Spring Boot相关包中用到的类。
Spring Boot下的 jar包 有哪些?
- spring-boot
- spring-boot-autoconfigure
- spring-boot-starter
- spring-boot-starter-json
- spring-boot-starter-tomcat
- 等等 TODO
spring-boot: org.springframework.boot
| @SpringBootConfiguration |
ben发布于博客园
spring-boot-autoconfigure: org.springframework.boot.autoconfigure
| @SpringBootApplication |
| @EnableAutoConfiguration |
| @AutoConfigurationPackage |
| @AutoConfigureAfter @AutoConfigureBefore @AutoConfigureOrder |
| @ImportAutoConfiguration |
spring-boot-autoconfigure: org.springframework.boot.autoconfigure.condition
| @ConditionalOnBean @ConditionalOnClass @ConditionalOnCloudPlatform @ConditionalOnExpression @ConditionalOnJava @ConditionalOnMissingBean @ConditionalOnMissingClass @ConditionalOnNotWebApplication @ConditionalOnProperty @ConditionalOnResource @ConditionalOnWarDeployment @ConditionalOnWebApplication |
ben发布于博客园
参考资料
1、java注解的使用
https://www.cnblogs.com/chentang/p/13959831.html
2、java开发注解大全
https://www.cnblogs.com/ranandrun/p/annotation.html
3、
ben发布于博客园

浙公网安备 33010602011771号