Hooking with action class
public class FeeAction extends BaseAction { .... .... //the usual struts action of way of calling a service. private static final FeeServiceFacade feeServiceFacade = new WebTierFeeServiceFacade(); //would be available only if FeeContext.xml is loaded onto spring container. private FeeServiceFacade getFeeServiceFacade() { Object svcFacade = MifosApplicationContext.getBean("feeServiceFacade"); return (svcFacade != null) ? (FeeServiceFacade) svcFacade : feeServiceFacade; } public ActionForward get(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { FeeDto feeDto = getFeeServiceFacade().getFeeDetails(((FeeActionForm) form).getFeeIdValue()); request.setAttribute("model", feeDto); return mapping.findForward(ActionForwards.get_success.toString()); } .... .... }
org.mifos.accounts.fees.servicefacade.MifosApplicationContext is an spring ApplicationContextAware bean. Use the static method getBean(beanName) to aquire an instance of the bean. Note, you should do a null check like above and return instance of legacy code if not found.
FeeContext.xml has been added to the web.xml. If you remove it from "contextConfigLocation" of context-param, the new classes will not be loaded onto spring context.