List of usage examples for org.springframework.context.support GenericApplicationContext getBean
@Override public Object getBean(String name) throws BeansException
From source file:uk.co.modularaudio.componentdesigner.generators.ComponentDesignerSupportFileGenerator.java
public void generateFiles() throws Exception { final GenericApplicationContext gac = cd.getApplicationContext(); final ConfigurationServiceImpl configurationService = gac.getBean(ConfigurationServiceImpl.class); final String waveTablesOutputDirectory = configurationService .getSingleStringValue("AdvancedComponents.WavetablesCacheRoot"); generateBlw(waveTablesOutputDirectory); }
From source file:uk.co.modularaudio.componentdesigner.generators.ComponentDesignerSupportFileGenerator.java
private String[] getDatabaseFiles() { final GenericApplicationContext gac = cd.getApplicationContext(); final HibernateSessionServiceImpl hssi = gac.getBean(HibernateSessionServiceImpl.class); final String dbFilename = hssi.getDatabaseFilename(); final String[] dbFiles = new String[2]; dbFiles[0] = dbFilename + ".script"; dbFiles[1] = dbFilename + ".properties"; return dbFiles; }
From source file:uk.co.modularaudio.util.springhibernate.SpringHibernateContextHelper.java
@Override public void postRefreshDoThings(final GenericApplicationContext appContext, final BeanInstantiationListAsPostProcessor beanInstatiationList) throws DatastoreException { final Map<String, ComponentWithHibernatePersistence> components = appContext .getBeansOfType(ComponentWithHibernatePersistence.class); final List<HibernatePersistedBeanDefinition> hpbdList = new ArrayList<HibernatePersistedBeanDefinition>(); for (final Iterator<ComponentWithHibernatePersistence> iter = components.values().iterator(); iter .hasNext();) {/*from w ww .j a va 2 s . c o m*/ final ComponentWithHibernatePersistence component = iter.next(); final List<HibernatePersistedBeanDefinition> hbmDefinitions = component .listHibernatePersistedBeanDefinitions(); hpbdList.addAll(hbmDefinitions); } // Now make sure the hibernate session service is configured try { final HibernateSessionFactory hssi = appContext.getBean(HibernateSessionFactory.class); hssi.configureHibernate(hpbdList); } catch (final Exception e) { final String msg = "Exception caught initialising hibernate persisted components: " + e.toString(); log.error(msg, e); throw new DatastoreException(msg, e); } }