Spring在加载Bean的时候,有用到order注解。
PS:顾名思义,Order是顺序,此注解可操作于类、方法、字段,当作用在类时,值越小,则加载的优先级越高!
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
@Documented
public @interface Order { /**
* The order value.
* <p>Default is {@link Ordered#LOWEST_PRECEDENCE}.
* @see Ordered#getOrder()
*/
int value() default Ordered.LOWEST_PRECEDENCE; }