class SpringServiceManager implements ServiceManagerSystem {

    @Override
    public void startup() {
        long startTime = System.currentTimeMillis();
        // get all spring config paths
        ArrayList<String> pathList = new ArrayList<String>();
        pathList.add(configPath);
        pathList.add(addonResourcePath);
        if (testMode) {
            log.warn("TEST Spring Service Manager running in test mode, no core beans will be started");
        } else {
            // only load the core beans when not testing the service manager
            pathList.add(coreResourcePath);
        }
        if (configPaths != null) {
            pathList.addAll(Arrays.asList(configPaths));
        }
        if(testMode){
            log.warn("TEST Spring Service Manager running in test mode, no dspace home spring files will be loaded");
        } else {
            //Retrieve all our spring file locations depending on the deployed module
            String[] springLoaderClassNames = configurationService.getArrayProperty("spring.springloader.modules");
            if(springLoaderClassNames != null){
                for(String springLoaderClassName : springLoaderClassNames){
                    try {
                        Class<SpringLoader> springLoaderClass = (Class<SpringLoader>) Class.forName(springLoaderClassName.trim());
                        String[] resourcePaths = springLoaderClass.getConstructor().newInstance().getResourcePaths(configurationService);
                        if(resourcePaths != null){
                            pathList.addAll(Arrays.asList(resourcePaths));
                        }
                    } catch (ClassNotFoundException e) {
                        //Ignore this exception, if we get one this just means that this module isn't loaded
                    } catch (Exception e) {
                        log.error("Error while retrieving spring resource paths for module: " + springLoaderClassName, e);
                    }
                }
            }
        }
        String[] allPaths = pathList.toArray(new String[pathList.size()]);
        applicationContext = new ClassPathXmlApplicationContext(allPaths, false);
        // Make sure that the spring files from the config directoy can override the spring files from our jars
        applicationContext.setAllowBeanDefinitionOverriding(true);
        applicationContext.setAllowCircularReferences(true);
        //applicationContext.registerShutdownHook(); // this interferes with the kernel shutdown hook
        // add the config interceptors (partially done in the xml)
        applicationContext.addBeanFactoryPostProcessor( new DSpaceBeanFactoryPostProcessor(parent, configurationService, testMode) );
        applicationContext.refresh();
        if (developmentMode) {
            log.warn("Spring Service Manager is running in developmentMode, services will be loaded on demand only");
            // TODO find a way to set this sucker to super duper lazy mode? it is currently not actually doing it
        } else {
            applicationContext.getBeanFactory().preInstantiateSingletons();
            applicationContext.getBeanFactory().freezeConfiguration();
        }
        long totalTime = System.currentTimeMillis() - startTime;
        log.info("Spring Service Manager started up in "+totalTime+" ms with "+applicationContext.getBeanDefinitionCount()+" services...");
    }

    public  SpringServiceManager(ServiceManagerSystem parent, DSpaceConfigurationService configurationService, boolean testMode, boolean developmentMode, String... configPaths);

}