今天在代码中加一个类然后报错,说是 applicaitonContext属性为null 找了半天最后是因为bean的加载顺序不对
在网上找了三种方法
第一种:@Order (但是很无奈在springboot中无效)
@Order(xxx) xxx表示优先级越小越大
第二种:@DependsOn(value = “springContextUtils”)加载完springContextUtils再加载此类
这个springContextUtils不是类名,是bean的名称,一般是首字符小写就好了,不然会出现找不到此类

第三种:最直接的一种 把你需要后面加载的类放到最深处
