请问springboot 自动注入mapper为空怎么回事

写了个多线程方法,多线程因为是new的自动注入不进去,
我想放到其他类中,然后多线程调用这个static方法,但还是注入不进去,怎么办啊?

@Component
public class DaoTemp {

private static MapperA a;


@Autowired
public static void setA(MapperA a) {
    DaoTemp.a = a;
}

static List<PageData> aaa(String number, PageData pd){
    List<PageData> list ;
    switch (number){
        case "0" :  list = a.listAll(pd);break;
        case "1" :  list = a.listAll1(pd);break;
        case "2" :  list = a.listAll2(pd);break;
        case "3" :  list = a.listAll3(pd);break;
        default:
            throw new IllegalStateException("Unexpected value: " + number);
    }
    return list;
}

}

改成这样,去掉static,因为自动注入不支持静态方法。

@Autowired
public void setA(MapperA a) {
    DaoTemp.a = a;
}

不能加static 去掉试试