DSpaceServiceManager implements ServiceManagerSystem { public <T> T getServiceByName(String name, Class<T> type) { checkRunning(); if (type == null) { throw new IllegalArgumentException("type cannot be null"); } T service = null; for (ServiceManagerSystem sms : serviceManagers) { try { service = sms.getServiceByName(name, type); if (service != null) { break; } } catch (Exception e) { } } if (service == null && name != null) { for (ServiceManagerSystem sms : serviceManagers) { if (service == null) { service = sms.getServiceByName(name, type); } } } return service; } DSpaceServiceManager(DSpaceConfigurationService configurationService); protected  DSpaceServiceManager(DSpaceConfigurationService configurationService, String... springXmlConfigFiles); boolean isRunning(); void notifyServiceManagerReady(); @Override void shutdown(); @Override void startup(); void registerService(String name, Object service); @Override void registerServiceNoAutowire(String name, Object service); T registerServiceClass(String name, Class<T> type); void unregisterService(String name); T getServiceByName(String name, Class<T> type); List<T> getServicesByType(Class<T> type); List<String> getServicesNames(); boolean isServiceExists(String name); Map<String, Object> getServices(); void pushConfig(Map<String, Object> properties); static void configureService(String serviceName, Object service, ConfigurationService config); static void initService(Object service); static void shutdownService(Object service);  }
@Test public void testGetServiceByName() { configurationService.clear(); dsm.startup(); ConcreteExample concrete = dsm.getServiceByName(ConcreteExample.class.getName(), ConcreteExample.class); assertNotNull(concrete); assertEquals("azeckoski", concrete.getName()); concrete = null; SampleAnnotationBean sab = dsm.getServiceByName(SampleAnnotationBean.class.getName(), SampleAnnotationBean.class); assertNotNull(sab); assertEquals(null, sab.getSampleValue()); sab = null; }