@BeforeClass public static void prepare() throws Exception // NOPMD { Registry.activateStandaloneMode(); Utilities.setJUnitTenant(); LOG.debug("Preparing..."); final ApplicationContext appCtx = Registry.getGlobalApplicationContext(); assertTrue( "Application context of type " + appCtx.getClass() + " is not a subclass of " + ConfigurableApplicationContext.class, appCtx instanceof ConfigurableApplicationContext); final ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) appCtx; final ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory(); assertTrue( "Bean Factory of type " + beanFactory.getClass() + " is not of type " + BeanDefinitionRegistry.class, beanFactory instanceof BeanDefinitionRegistry); final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory); xmlReader.setDocumentReaderClass(ScopeTenantIgnoreDocReader.class); xmlReader.loadBeanDefinitions( new ClassPathResource( "/merchandisefulfilmentprocess/test/merchandisefulfilmentprocess-spring-test.xml")); xmlReader.loadBeanDefinitions( new ClassPathResource( "/merchandisefulfilmentprocess/test/merchandisefulfilmentprocess-spring-test-fraudcheck.xml")); xmlReader.loadBeanDefinitions( new ClassPathResource( "/merchandisefulfilmentprocess/test/process/order-process-spring.xml")); modelService = (ModelService) getBean("modelService"); processService = (DefaultBusinessProcessService) getBean("businessProcessService"); definitonFactory = processService.getProcessDefinitionFactory(); LOG.warn("Prepare Process Definition factory..."); definitonFactory.add( "classpath:/merchandisefulfilmentprocess/test/process/payment-process.xml"); // setup command factory to mock final DefaultCommandFactoryRegistryImpl commandFactoryReg = appCtx.getBean(DefaultCommandFactoryRegistryImpl.class); commandFactoryReg.setCommandFactoryList( Arrays.asList((CommandFactory) appCtx.getBean("mockupCommandFactory"))); taskServiceStub = appCtx.getBean(TaskServiceStub.class); productService = appCtx.getBean("defaultProductService", DefaultProductService.class); cartService = appCtx.getBean("defaultCartService", DefaultCartService.class); userService = appCtx.getBean("defaultUserService", DefaultUserService.class); }
@Override public void run() { Registry.setCurrentTenant(Registry.getTenantByID(tenant)); try { final ConsignmentModel model = getModelService().get(PK.fromLong(consignment)); getWarehouse2ProcessAdapter() .receiveConsignmentStatus(model, WarehouseConsignmentStatus.COMPLETE); } finally { Registry.unsetCurrentTenant(); } }
public void run() { Registry.activateStandaloneMode(); Registry.activateMasterTenant(); final JaloSession jaloSession = JaloSession.getCurrentSession(); System.out.println("Session ID: " + jaloSession.getSessionID()); // NOPMD System.out.println("User: " + jaloSession.getUser()); // NOPMD Utilities.printAppInfo(); RedeployUtilities.shutdown(); }
public static FacetDisplayNameProvider getFacetDisplayNameProvider( final IndexedProperty property) { final String name = property.getFacetDisplayNameProvider(); return name == null ? null : Registry.getGlobalApplicationContext().getBean(name, FacetDisplayNameProvider.class); }
/** * Get the valid instance of this manager. * * @return the current instance of this manager */ public static V2kartdotzotlspintegrationManager getInstance() { return (V2kartdotzotlspintegrationManager) Registry.getCurrentTenant() .getJaloConnection() .getExtensionManager() .getExtension(V2kartdotzotlspintegrationConstants.EXTENSIONNAME); }
/** * Get the valid instance of this manager. * * @return the current instance of this manager */ public static TrainingfulfilmentprocessManager getInstance() { return (TrainingfulfilmentprocessManager) Registry.getCurrentTenant() .getJaloConnection() .getExtensionManager() .getExtension(TrainingfulfilmentprocessConstants.EXTENSIONNAME); }
BusyWaitingUpdateReloadRunner( final ModelService modelService, final MediaModel media, final boolean isReader) { this.media = media; this.modelService = modelService; this.isReader = isReader; this.tenant = Registry.getCurrentTenantNoFallback(); }
@Override public HtmlBasedComponent createViewComponent( final Object initialValue, final Map<String, ?> parameters, final EditorListener listener) { final EnumerationService enumService = (EnumerationService) Registry.getApplicationContext().getBean("enumerationService"); setAvailableValues(enumService.getEnumerationValues(UiExperienceLevel._TYPECODE)); return super.createViewComponent(initialValue, parameters, listener); }
@Override public void run() { Registry.setCurrentTenant(tenant); if (isReader) { System.out.println("Starting in reader mode"); runAsReader(); } else { System.out.println("Starting in writer mode"); runAsWriter(); } }
@Before public void setUp() throws IOException { impExAdaptorHolder.setImpExAdaptor(new DefaultImpExAdaptor()); robotTestContextHolder.setRobotTestContext(this); KeywordLibraryContextHolder.setKeywordLibraryContext(keywordLibraryContext); modelService = (ModelService) Registry.getApplicationContext().getBean("modelService"); startSuite(); }
@After public void tearDown() { final ConfigurableApplicationContext ctx = (ConfigurableApplicationContext) Registry.getApplicationContext(); final DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory) ctx.getBeanFactory(); beanFactory.removeBeanDefinition(PROCEDURAL_ACTION_ID); beanFactory.removeBeanDefinition(JOURNAL_ID); processDefinitionsCache.clear(); }
@Test public void businessProcessShouldPickUpLatestProcessDefinition() throws InterruptedException { final ActionsJournal journal = Registry.getApplicationContext().getBean(ActionsJournal.class); givenUpdatedProcessDefinition(); final BusinessProcessModel businessProcess = businessProcessService.startProcess(TEST_PROCESS_CODE, TEST_DEFINITION_CODE); waitFor(businessProcess); assertThat(businessProcess.getProcessDefinitionName()).isEqualTo(TEST_DEFINITION_CODE); assertThat(businessProcess.getProcessDefinitionVersion()) .isNotNull() .isEqualTo(Long.toString(1L)); journal.verify(businessProcess.getCode(), PROCEDURAL_ACTION_ID, UPDATED_NUMBER_OF_NODES); }
/** @return first template from given list that is restricted to ContentPage */ protected static PageTemplateModel getContentPageTemplate( final Collection<PageTemplateModel> pageTemplates) { final TypeModel contentPageType = Registry.getApplicationContext() .getBean("typeService", TypeService.class) .getTypeForCode(CONTENT_PAGE); for (final PageTemplateModel pageTemplateModel : pageTemplates) { final Set<CMSPageTypeModel> restrictedPageTypes = pageTemplateModel.getRestrictedPageTypes(); if (CollectionUtils.isNotEmpty(restrictedPageTypes) && restrictedPageTypes.contains(contentPageType)) { return pageTemplateModel; } } return null; }
@AfterClass public static void removeProcessDefinitions() { LOG.debug("cleanup..."); final ApplicationContext appCtx = Registry.getGlobalApplicationContext(); assertTrue( "Application context of type " + appCtx.getClass() + " is not a subclass of " + ConfigurableApplicationContext.class, appCtx instanceof ConfigurableApplicationContext); final ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) appCtx; final ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory(); assertTrue( "Bean Factory of type " + beanFactory.getClass() + " is not of type " + BeanDefinitionRegistry.class, beanFactory instanceof BeanDefinitionRegistry); final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory); xmlReader.loadBeanDefinitions( new ClassPathResource( "/merchandisefulfilmentprocess/test/merchandisefulfilmentprocess-spring-testcleanup.xml")); // cleanup command factory final Map<String, CommandFactory> commandFactoryList = applicationContext.getBeansOfType(CommandFactory.class); commandFactoryList.remove("mockupCommandFactory"); final DefaultCommandFactoryRegistryImpl commandFactoryReg = appCtx.getBean(DefaultCommandFactoryRegistryImpl.class); commandFactoryReg.setCommandFactoryList(commandFactoryList.values()); // if (definitonFactory != null) // { // TODO this test seems to let processes run after method completion - therefore we cannot // remove definitions !!! // definitonFactory.remove("testPlaceorder"); // definitonFactory.remove("testConsignmentFulfilmentSubprocess"); // } processService.setTaskService(appCtx.getBean(DefaultTaskService.class)); definitonFactory = null; processService = null; }
@Test public void runningBusinessProcessShouldFinishWithOldProcessDefinition() throws InterruptedException { final ActionsJournal journal = Registry.getApplicationContext().getBean(ActionsJournal.class); final DynamicProcessDefinitionModel initialProcessDefinition = givenInitialProcessDefinition(); final BusinessProcessModel businessProcess = businessProcessService.createProcess(TEST_PROCESS_CODE, TEST_DEFINITION_CODE); businessProcessService.startProcess(businessProcess); final DynamicProcessDefinitionModel latestProcessDefinition = givenUpdatedProcessDefinitionOf(initialProcessDefinition); waitFor(businessProcess); assertThat(businessProcess.getProcessDefinitionName()).isEqualTo(TEST_DEFINITION_CODE); assertThat(businessProcess.getProcessDefinitionVersion()) .isNotNull() .isNotEqualTo(latestProcessDefinition.getChecksum()); journal.verify(businessProcess.getCode(), PROCEDURAL_ACTION_ID, INITIAL_NUMBER_OF_NODES); }
@Override public void prepareConsignment(final ConsignmentModel consignment) { for (final ConsignmentEntryModel consignmentEntries : consignment.getConsignmentEntries()) { consignmentEntries.setShippedQuantity(consignmentEntries.getQuantity()); } consignment.setStatus(ConsignmentStatus.READY); getModelService().save(consignment); final Thread warehouse = new Thread( new Warehouse( Registry.getCurrentTenant().getTenantID(), consignment.getPk().getLongValue())); warehouse.start(); try { Thread.sleep(3000); } catch (final InterruptedException e) { // nothing to do } }
@Before public void setUp() { final ConfigurableApplicationContext ctx = (ConfigurableApplicationContext) Registry.getApplicationContext(); final DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory) ctx.getBeanFactory(); beanFactory.registerBeanDefinition( JOURNAL_ID, BeanDefinitionBuilder.rootBeanDefinition(ActionsJournal.class) .setScope("singleton") .getBeanDefinition()); beanFactory.registerBeanDefinition( PROCEDURAL_ACTION_ID, BeanDefinitionBuilder.rootBeanDefinition(RecordableProceduralAction.class) .setScope("singleton") .addConstructorArgValue(PROCEDURAL_ACTION_ID) .addConstructorArgReference(JOURNAL_ID) .getBeanDefinition()); }
@AfterClass public static void removeProcessDefinitions() { LOG.debug("cleanup..."); final ApplicationContext appCtx = Registry.getApplicationContext(); assertTrue( "Application context of type " + appCtx.getClass() + " is not a subclass of " + ConfigurableApplicationContext.class, appCtx instanceof ConfigurableApplicationContext); final ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) appCtx; final ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory(); assertTrue( "Bean Factory of type " + beanFactory.getClass() + " is not of type " + BeanDefinitionRegistry.class, beanFactory instanceof BeanDefinitionRegistry); final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory); xmlReader.loadBeanDefinitions( new ClassPathResource( "/octannerfulfilmentprocess/test/octannerfulfilmentprocess-spring-testcleanup.xml")); // cleanup command factory final Map<String, CommandFactory> commandFactoryList = applicationContext.getBeansOfType(CommandFactory.class); commandFactoryList.remove("mockupCommandFactory"); final DefaultCommandFactoryRegistryImpl commandFactoryReg = appCtx.getBean(DefaultCommandFactoryRegistryImpl.class); commandFactoryReg.setCommandFactoryList(commandFactoryList.values()); processService.setTaskService(appCtx.getBean(DefaultTaskService.class)); definitonFactory = null; processService = null; }
/** Creates some attachments and assigns them to the test workflow. */ @Test public void testAttachments() { final PK workflowPk = testWorkflow.getPK(); // create product attachment final Product product = jaloSession.getProductManager().createProduct("sabbers"); assertNotNull("Product not null", product); Map<String, Object> map = new HashMap<String, Object>(); map.put(WorkflowItemAttachment.CODE, "productTest"); map.put(WorkflowItemAttachment.ITEM, product); map.put(WorkflowItemAttachment.WORKFLOW, testWorkflow); final WorkflowItemAttachment attachProduct = WorkflowManager.getInstance().createWorkflowItemAttachment(map); assertNotNull("Attachment not null", attachProduct); // create category attachment final Category category = CategoryManager.getInstance().createCategory(PK.createUUIDPK(0).getHex()); assertNotNull("Category not null", category); map = new HashMap<String, Object>(); map.put(WorkflowItemAttachment.CODE, "categoryTest"); map.put(WorkflowItemAttachment.ITEM, category); map.put(WorkflowItemAttachment.WORKFLOW, testWorkflow); final WorkflowItemAttachment attachCategory = WorkflowManager.getInstance().createWorkflowItemAttachment(map); assertNotNull("Attachment not null", attachCategory); final WorkflowAction action1 = getAction(ACTIONCODES.ACTION1.name()); action1.setAttachments( Arrays.asList(new WorkflowItemAttachment[] {attachProduct, attachCategory})); // restart Registry.getCurrentTenant().getCache(); // check attachments final Workflow found = JaloSession.getCurrentSession().getItem(workflowPk); assertEquals("Excpected number of attachments", 2, found.getAttachments().size()); final WorkflowAction foundAction = getAction(ACTIONCODES.ACTION1.name()); assertEquals( "Excpected number of attachments of action 1", 2, foundAction.getAttachments().size()); }
/* * test deactivated, but this test can show */ public void NOtestBugWithSQL() { Connection conn = null; Statement stmt = null; try { conn = Registry.getCurrentTenant().getDataSource().getConnection(); conn.setAutoCommit(false); stmt = conn.createStatement(); stmt.execute( "INSERT INTO junit_MediaFormat (PK,typepkstring,createdTS,p_qualifier) VALUES (11,1,'98-12-31 11:30:45','11')"); stmt.close(); stmt = null; stmt = conn.createStatement(); stmt.execute( "INSERT INTO junit_MediaFormat (PK,typepkstring,createdTS,p_qualifier) VALUES (11,1,'98-12-31 11:30:45','12')"); stmt.close(); stmt = null; } catch (final Exception e) { System.out.println("exception:" + e.getMessage()); } finally { Utilities.tryToCloseJDBC(null, stmt, null); try { ResultSet rs = null; System.out.println(conn.hashCode()); conn.rollback(); // ACTIVATE THESE LINES TO MAKE IT WORK // ((ConnectionImpl)conn).getUnderlayingConnection().close(); // Registry.getCurrentTenant().getDataSource().invalidate( (ConnectionImpl)conn ); // conn=null; // conn = Registry.getCurrentTenant().getDataSource().getConnection(); // System.out.println(conn.hashCode()); stmt = conn.createStatement(); rs = stmt.executeQuery("SELECT COUNT(*) FROM junit_MediaFormat WHERE PK=11 OR PK=12"); rs.next(); final int cnt = rs.getInt(1); rs.close(); rs = null; stmt.close(); stmt = null; assertEquals("item still alive after rollback!", 0, cnt); } catch (final SQLException e) { // DOCTODO Document reason, why this block is empty } finally { Utilities.tryToCloseJDBC(null, stmt, null); try { stmt = conn.createStatement(); stmt.executeQuery("DELETE FROM junit_mediaFormat WHERE PK=11 OR PK=12"); stmt.close(); stmt = null; } catch (final Exception e) { // DOCTODO Document reason, why this block is empty } finally { Utilities.tryToCloseJDBC(conn, stmt, null); } } } }
/** @return businessProcessService */ public BusinessProcessService getBusinessProcessService() { return (BusinessProcessService) Registry.getApplicationContext().getBean("businessProcessService"); }
protected static Object getBean(final String name) { return Registry.getApplicationContext().getBean(name); }
@BeforeClass public static void prepare() throws Exception // NOPMD { Registry.activateStandaloneMode(); Utilities.setJUnitTenant(); LOG.debug("Preparing..."); final ApplicationContext appCtx = Registry.getApplicationContext(); // final ConfigurationService configurationService = (ConfigurationService) // appCtx.getBean("configurationService"); // configurationService.getConfiguration().setProperty("processengine.event.lockProcess", // "true"); assertTrue( "Application context of type " + appCtx.getClass() + " is not a subclass of " + ConfigurableApplicationContext.class, appCtx instanceof ConfigurableApplicationContext); final ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) appCtx; final ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory(); assertTrue( "Bean Factory of type " + beanFactory.getClass() + " is not of type " + BeanDefinitionRegistry.class, beanFactory instanceof BeanDefinitionRegistry); final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory); xmlReader.setDocumentReaderClass(ScopeTenantIgnoreDocReader.class); xmlReader.loadBeanDefinitions( new ClassPathResource( "/octannerfulfilmentprocess/test/octannerfulfilmentprocess-spring-test.xml")); xmlReader.loadBeanDefinitions( new ClassPathResource("/octannerfulfilmentprocess/test/process/order-process-spring.xml")); xmlReader.loadBeanDefinitions( new ClassPathResource( "/octannerfulfilmentprocess/test/process/consignment-process-spring.xml")); modelService = (ModelService) getBean("modelService"); processService = (DefaultBusinessProcessService) getBean("businessProcessService"); definitonFactory = processService.getProcessDefinitionFactory(); LOG.warn("Prepare Process Definition factory..."); definitonFactory.add("classpath:/octannerfulfilmentprocess/test/process/order-process.xml"); definitonFactory.add( "classpath:/octannerfulfilmentprocess/test/process/consignment-process.xml"); LOG.warn( "loaded 'order-process-test':" + definitonFactory.getProcessDefinition("order-process-test") + " in factory " + definitonFactory); // setup command factory to mock taskServiceStub = appCtx.getBean(TaskServiceStub.class); processService.setTaskService(taskServiceStub); final DefaultCommandFactoryRegistryImpl commandFactoryReg = appCtx.getBean(DefaultCommandFactoryRegistryImpl.class); commandFactoryReg.setCommandFactoryList( Arrays.asList((CommandFactory) appCtx.getBean("mockupCommandFactory"))); }
protected List<String> getExtensionNames() { return Registry.getCurrentTenant().getTenantSpecificExtensionNames(); }
public void _jspService( final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { final javax.servlet.jsp.PageContext pageContext; javax.servlet.http.HttpSession session = null; final javax.servlet.ServletContext application; final javax.servlet.ServletConfig config; javax.servlet.jsp.JspWriter out = null; final java.lang.Object page = this; javax.servlet.jsp.JspWriter _jspx_out = null; javax.servlet.jsp.PageContext _jspx_page_context = null; try { response.setContentType("text/html"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("\r\n\r\n"); final DisplayState theDisplayState = (DisplayState) request.getAttribute(MasterServlet.STATE); final Frame frame = (Frame) request.getAttribute(AbstractChip.FRAME_KEY); /* //to be definitive NOT serializable InputStream noser = (InputStream)session.getAttribute( "NOT_SERIALIZABLE"); if( noser==null ) { session.setAttribute( "NOT_SERIALIZABLE", new ByteArrayInputStream( new byte[0] )); } */ out.write('\r'); out.write('\n'); final AbstractAutocompleterToolbarActionChip theChip = (AbstractAutocompleterToolbarActionChip) request.getAttribute(AbstractChip.CHIP_KEY); final String label = (theChip.getLabel() == null ? "" : localized(theChip.getLabel())); final String tooltip = (theChip.getTooltip() == null ? label : localized(theChip.getTooltip())); final String width = theChip.getWidth() != null && theChip.getWidth().length() > 0 ? theChip.getWidth() : "200px"; final String value = theChip.getValue() != null ? "value=\"" + theChip.getValue() + "\"" : ""; final String contextMenu = theChip.hasVisibleContextMenuEntries() ? "(new Menu(" + theChip.createMenuEntriesForJS(theChip.getMenuEntries()) + ", event, null, null, { uniqueName: '" + theChip.getUniqueName() + "'} )).show(); return false;" : "return false;"; out.write("\r\n\r\n<td title=\""); out.print(tooltip); out.write("\" class=\"toolbar-autocomplete\" oncontextmenu=\""); out.print(contextMenu); out.write( "\">\r\n\t<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n\t\t<tr>\r\n\t\t\t<td class=\"label\">"); out.print(label); out.write(":</td>\r\n\t\t\t<td><input type=\"text\" \r\n\t\t\t\t\t\t id=\""); out.print(theChip.getInputID()); out.write("\" \r\n\t\t\t\t\t\t style=\"width:"); out.print(width); out.write(";\"\r\n\t\t\t\t\t\t name=\""); out.print(theChip.getEventID(AbstractAutocompleterToolbarActionChip.VALUE)); out.write("\" \r\n\t\t\t\t\t\t "); out.print(value); out.write("/><div id=\""); out.print(theChip.getMatchesID()); out.write("\" class=\"autocomplete\"></div></td>\r\n\t\t</tr>\r\n\t</table>\r\n</td>\r\n"); final String options = "{ paramName: '" + AbstractAutocompleterToolbarActionChip.SEARCH + "'," + "afterUpdateElement: function(inputElement, selectedListItem) " + "{ if( selectedListItem.nodeName == \"LI\" )" + "{ setEvent('" + theChip.getCommandID(AbstractAutocompleterToolbarActionChip.SELECT) + "', domQuery('span.hidden', selectedListItem)[0].firstChild.nodeValue);setScrollAndSubmit(); }" + "else " + "{ inputElement.value = \"\"; }}," + "onShow: function(element, update)" + "{ if(!update.style.position || update.style.position=='absolute')" + "{ update.style.position = 'absolute'; Position.clone(element, update, { setHeight: false, setWidth:false, offsetTop: element.offsetHeight }); }" + "Effect.Appear(update,{duration:0.15}); } }"; final String tenantIDStr = Registry.getCurrentTenant() instanceof SlaveTenant ? ";tenantID=" + Registry.getCurrentTenant().getTenantID() : ""; out.write("\r\n<script language=\"JavaScript1.2\">\r\n\t\r\n\tnew Ajax.Autocompleter(\""); out.print(theChip.getInputID()); out.write("\", \""); out.print(theChip.getMatchesID()); out.write("\", \"prototype"); out.print(tenantIDStr); out.write('?'); out.print(PrototypeServlet.CHIPID); out.write('='); out.print(theChip.getID()); out.write('"'); out.write(','); out.write(' '); out.print(options); out.write(");\r\n\r\n</script>\r\n\t\t\n"); } catch (java.lang.Throwable t) { if (!(t instanceof javax.servlet.jsp.SkipPageException)) { out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { if (response.isCommitted()) { out.flush(); } else { out.clearBuffer(); } } catch (java.io.IOException e) { } if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } }
protected static SessionService getStaticSessionService() { return Registry.getApplicationContext().getBean("sessionService", SessionService.class); }
protected BusinessProcessService getBusinessProcessService() { return Registry.getApplicationContext() .getBean("businessProcessService", BusinessProcessService.class); }
protected <T> T getBeanForName(final String name) { return (T) Registry.getApplicationContext().getBean(name); }