注解 |
对象范围 |
全称 |
介绍 |
@PostConstruct |
@Target(METHOD) |
javax.annotation.PostConstruct |
|
@PreDestroy |
@Target(METHOD) |
javax.annotation.PreDestroy |
作用为:在容器销毁Bean的时候回调执行,用于释放资源 注:除作用不同外,其他注意事项同@PostConstruct注解一致 |
@Resource |
@Target({TYPE, FIELD, METHOD}) |
javax.annotation.Resource |
|
@Resources |
@Target(TYPE) |
javax.annotation.Resources |
|
@Autowired |
@Target({ ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD, ElementType.ANNOTATION_TYPE }) |
org.springframework.beans.factory .annotation.Autowired |
|
@Qualifier |
@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE, ElementType.ANNOTATION_TYPE }) |
org.springframework.beans.factory .annotation.Qualifier |
|
Web开发中常用注解
于 2024-03-06 20:52:22 首次发布