项目启动想加载些数据进本地缓存,用实现CommandLineRunner 的方式不生效,只能启用PostConstruct,run方法上@async无法生效,具体原因未探究
@Component
public class StartRunner {
@Autowired
private UserService userService;
@PostConstruct
public void run (){
System.out.println("===============》预缓存数据:userMap!");
userService.getUserMap();
}
}