拈花一笑 @:Java注解大全

本文介绍了Java世界中的注解使用,包括常用的如@Override、@Deprecated,元注解如@Target、@Retention,以及在JUnit测试、Lombok、Spring框架、Hibernate、Struts2、Mybatis和SpringBoot等场景下的应用。同时提到了分布式和服务治理相关的注解和技术,如Eureka、Ribbon和Hystrix。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

# 呵呵,Java注解以@为标识....看到@,当你展开想像,它像不像一朵花呢,一朵朵花呢
# 在Java的世界里,发展到今天,就像天女散花一般,到处都 @,好多好多的 @ 噢

■■ JavaSE

■□ Java注解

■ Java常用注解

  • @Override
  • @SuppressWarnings
  • @Deprecated
  • @FunctionalInterface

■ 元注解

  • @Target
  • @Retention
  • @Documented
  • @Inherited
  • @

■ 其它

  • @SafeVarargs
  • @Repeatable

■□ 单元测试JUnit

■ JUnit常用注解

  • @Before
  • @After
  • @Test

■ JUnit次常用注解

  • @Ignore
  • @BeforeClass
  • @AfterClass
  • @RunWith(Parameterized.class)
  • @Parameters 加在静态方法上

■ JUnit其他注解

  • @DisplayName
  • @BeforeEach
  • @AfterEach
  • @BeforeAll
  • @AfterAll
  • @RepeatedTest
  • @Timeout
  • @Disabled
  • @

■□ Lombok

■ 常用注解

  • @Data
  • @Getter
  • @Setter
  • @Sfl4j

■ 次常用注解

  • @AllArgsConstructor
  • @NoArgsConstructor
  • @RequiredArgsConstructor
  • @ToString
  • @NotNull

■ 其他注解

  • @EqualsAndHashCode

■■ JavaWeb

■□ Java Web 3.0

■ 常用注解

  • @WebServlet
  • @WebFilter
  • @WebListener

■□ JSON交互:Jackson

■ 常用注解

  • @JsonFormat
  • @JsonIgnore

■■ JavaEE

■□ Struts2

■ struts2四大常用注解

  • @ParentPackage("struts-default")
  • @Namespace("/")
  • @Action(value=,results={})
  • @Result(name=,type=,location=)

■□ Hibernate(JPA)

■ 类上注解

  • @Entity
  • @Table(name=)
  • @

■ 属性上注解:基本注解

  • @Id
  • @GeneratedValue
  • @Column(property=)
  • @Transient
  • @IdClass
  • @Basic
  • @Enumerated

■ 属性上注解:关联注解

  • @OneToOne
  • @OneToManany
  • @ManyToOne
  • @ManyToMany
  • @

■□ Spring

■ Ioc

  • @Component
  • @Constroller
  • @Service
  • @Repository
  • @Value
  • @Autowired
  • @Qualifier
  • @Resource
  • @PostConstruct
  • @PreDestory
  • @Scope

■ 整合测试

  • @ContextConfiguration("classpath:applicationContext.xml")
  • @RunWith(value=SpringJUnit4ClassRunner.class)
  • @

■ AOP

  • @Aspect
  • @Before
  • @AfterReturning
  • @AfterThrowing
  • @After
  • @Around
  • @Pointcut
  • @Component

■ 配置类

  • @Configuration
  • @ComponentScan(basePackage="com.xxx")
  • @PropertySource(value="classpath:db.properties")
  • @Import(value={DataSourceConfig.class})
  • @Bean

■ 事务

  • @Transactional

■ 其它:SpringMVC相关

  • 参见springmvc部分

■□ Mybatis

■ CRUD基本操作

  • @Select
  • @Insert
  • @Update
  • @Delete
  • @Param

■ 结果映射与多表查询

  • @Results
  • @Result
  • @One
  • @Many

■ 二级缓存

  • @CacheNamespace(blocking=true)

■ 动态SQL

  • @SelectProvider
  • @InsertProvider
  • @UpdateProvider
  • @DeleteProvider

■ 其它

  • @

■□ SpringMVC

■ 常用注解

  • @RestController
  • @RequestMapping
  • @GetMapping
  • @PostMapping
  • @RequestParam
  • @Validated
  • @Valid
  • @Size @NotNull @NotBlank ...
  • @ModelAttribute("key")
  • @RequestBody
  • @ResponseBody
  • @PathVariable

■ 其它:校验相关

  • @Null
  • @NotNull
  • @Min
  • @Max
  • @Length
  • @NotEmpty
  • @Pattern
  • @Email
  • @Range
  • @AssertTrue
  • @AssertFalse
  • @

■ 其它:Others

  • @Null
  • @NotNull
  • @Min
  • @Max

■□ Shiro

■ C

  • @S
  • @

■ 

  • @C

■ 其它

  • @

■■ 分布式&面向服务:SOA&微服务&服务网格

■□ Web Services:CXF

■ 常用注解

  • @WebService
  • @WebMethod

■ 其他注解

  • @Oneway
  • @WebParam
  • @WebResult
  • @

■□ SpringBoot

■ 常用注解

  • @SpringBootApplication
  • @SpringBootConfiguration
  • @ComponentScan
  • @EnableAutoConfiguration
  • @Configuration
  • @PropertySource("classpath:jdbc.properties")
  • @Bean
  • @Value
  • @EnableConfigurationProperties("JdbcProperties.class")
  • @ConfigurationProperties(prefix="jdbc")

■ 整合测试

  • @RunWith(SpringRunner.class)
  • @SpringBootTest(classes=)

■ 组合注解

  • @SpringBootApplication
  • = @SpringBootConfiguration + @ComponentScan + @EnableAutoConfiguration
  • @

■ 其他注解

  • @MapperScan("com.xxx.ms.pojo")

■□ Spring Cloud(Netflix)

■ Eureka

  • @EnableEurekaServer
  • @EnableEurekaClient
  • @EnableDiscoveryClient

■ Ribbon

  • @LoadBalanced

■ Hystrix

  • @EnableCircuitBreaker
  • @HystrixCommand
  • @DefaultProperties

■ Feign

  • @EnableFeignClients
  • @FeignClient

■ Zuul

  • @EnableZuulProxy

■ 其它

  • 组合注解:@SpringCloudApplication
  • = @SpringBootApplication + @EnableDiscoveryClient + @EnableCircuitBreaker

■□ Spring Cloud Alibaba

■ 

  • @P

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值