protected void initCompanion(Element companionsElem, AbstractFrame frame) { String clientTypeId = AppConfig.getClientType().toString().toLowerCase(); Element element = companionsElem.element(clientTypeId); if (element != null) { String className = element.attributeValue("class"); if (!StringUtils.isBlank(className)) { Class aClass = getScripting().loadClassNN(className); Object companion; try { companion = aClass.newInstance(); frame.setCompanion(companion); CompanionDependencyInjector cdi = new CompanionDependencyInjector(frame, companion); cdi.setBeanLocator(beanLocator); cdi.inject(); } catch (Exception e) { throw new RuntimeException("Unable to init companion for frame", e); } } } }