java 系统开发常用注解

Spring

Data

  • @DynamicInsert
  • @DynamicUpdate
  • @Entity
  • @Table(name = "")
  • @Id
  • @GeneratedValue(strategy = GenerationType.IDENTITY)
  • @Column(name = "")

Spring

  • @Bean
  • @Component
  • @ComponentScan(basePackages = "com.chen.learnspring")
  • @Profile(value = "prod")
  • @Autowired
  • @Conditional
  • @Primary
  • @Qualifier("bean id")
  • @Scope("prototype") 设置bean的作用域: "Singleton" :单例 , "Prototype" : 原型(每次注入都会创建新的bean),"Session": 会话,"Request" : 请求. (Spring实战第4版 86页)

AOP

  • @Aspect
  • @Before
  • @AfterReturning
  • @AfterThrowing
  • @Around
  • @EnableAspectJAutoProxy
  • PointCut
  • DeclareParents

spring.aop.auto=true SpringBoot

Test

  • @RunWith(SpringJUnit4ClassRunner.class)
  • @ContextConfiguration(classes = CDPlayerConfig.class)
  • @ActiveProfiles(value = "prod")

校验注解 javax.validation.constraints

  • AssertFalse
  • AssertTrue
  • DecimalMax
  • DecimalMin
  • Digits
  • Size
  • PositiveOrZero
  • Positive
  • Pattern
  • Min
  • Max
  • Future

异常

  • @ResponseStatus(value = HttpStatus.ACCEPTED,reason = "Not Found")
  • @ExceptionHandler

你可能感兴趣的:(java 系统开发常用注解)