1. 程式人生 > >Spring專案普通工具類中呼叫service介面

Spring專案普通工具類中呼叫service介面

WebApplicationContext context = ContextLoader.getCurrentWebApplicationContext();
IControlService controlService= (IControlService) context.getBean("controlService");

直接用這兩行程式碼,已測可用