// Autowired 注入 MagicAPIService magicAPIServicebean = SpringContextHolder.getBean(MagicAPIService.class);
List<Map<String,String>> value = magicAPIServicebean.execute("GET", "/costAccounting/dept/getList", params);
引用的工具类
@Slf4j @Configuration public class SpringContextHolder implements ApplicationContextAware, DisposableBean { private static ApplicationContext applicationContext = null; private static final Logger log = LoggerFactory.getLogger(ExcelUtils.class); /** * 取得存储在静态变量中的ApplicationContext. */ public static ApplicationContext getApplicationContext() { assertContextInjected(); return applicationContext; } /** * 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类