feat: enhance @PostConstruct with order and @Qualifier for fields
- Add value() to @PostConstruct for execution order control - Allow @Qualifier on fields for use with @Inject - Sort @PostConstruct methods by inheritance depth then order value Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,4 +13,11 @@ import java.lang.annotation.Target;
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface PostConstruct {
|
||||
|
||||
/**
|
||||
* 执行顺序,数值越小越先执行,默认为 0
|
||||
*
|
||||
* @return 执行顺序
|
||||
*/
|
||||
int value() default 0;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.lang.annotation.Target;
|
||||
*
|
||||
* @author 夜雨
|
||||
*/
|
||||
@Target(ElementType.PARAMETER)
|
||||
@Target({ElementType.PARAMETER, ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Qualifier {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user