@component
public class test implements beanpostprocessor, ordered {
@override
public object postprocessbeforeinitialization(object bean, string beanname) throws beansexception {
return bean;
}
@override
public object postprocessafterinitialization(object bean, string beanname) throws beansexception {
return bean;
}
@override
public int getorder() {
return 1;
}
}
也可以使用 @order 注解进行排序
@configuration
@order(2)
public class demo1config {
@bean
public demo1service demo1service(){
system.out.println("demo1config 加载了");
return new demo1service();
}
}