RefreshConfigurationCommand implements CommandHasRequest<RefreshConfigurationRequest, RefreshConfigurationResponse> { @Override public void execute(RefreshConfigurationRequest request, RefreshConfigurationResponse response) throws Exception { if (context instanceof ReconfigurableApplicationContext) { ReconfigurableApplicationContext rollback = (ReconfigurableApplicationContext) context; if (request.getConfigLocations() != null) { ArrayList<String> configLocations = new ArrayList<String>(); configLocations.add("org/geomajas/spring/geomajasContext.xml"); configLocations.addAll(Arrays.asList(request.getConfigLocations())); try { rollback.refresh(configLocations.toArray(new String[configLocations.size()])); } catch (GeomajasException e) { log.error("Could not refresh context", e); rollback.rollback(); response.setApplicationNames(context.getBeanNamesForType(ClientApplicationInfo.class)); throw e; } response.setApplicationNames(context.getBeanNamesForType(ClientApplicationInfo.class)); } } else { response.setApplicationNames(context.getBeanNamesForType(ClientApplicationInfo.class)); throw new GeomajasException(ExceptionCode.REFRESH_CONFIGURATION_FAILED); } }  @Override RefreshConfigurationRequest getEmptyCommandRequest(); @Override RefreshConfigurationResponse getEmptyCommandResponse(); @Override void execute(RefreshConfigurationRequest request, RefreshConfigurationResponse response);  }
@Test @DirtiesContext public void testRefreshConfiguration() throws Exception { Assert.assertEquals("", recorder.matches("test", "postConstruct")); recorder.clear(); RefreshConfigurationRequest request = new RefreshConfigurationRequest(); request.setConfigLocations(new String[] {}); RefreshConfigurationResponse response = (RefreshConfigurationResponse) dispatcher.execute( RefreshConfigurationRequest.COMMAND, request, null, "en"); }