private XMLConfiguration loadConfig(String fileName) throws Exception { try (InputStream is = XMLConfiguration.class.getResourceAsStream(fileName); ) { Node root = XMLConfiguration.loadDocument(is); print(root.getOwnerDocument()); } XMLConfiguration xmlConfig = new XMLConfiguration( null, new MockConfigurationResourceProvider( () -> XMLConfiguration.class.getResourceAsStream(fileName))); GridSetBroker gsb = new GridSetBroker(Arrays.asList(new DefaultGridsets(true, true), xmlConfig)); xmlConfig.setGridSetBroker(gsb); xmlConfig.afterPropertiesSet(); Iterator<TileLayer> iter = xmlConfig.getLayers().iterator(); while (iter.hasNext()) { TileLayer layer = iter.next(); layer.initialize(gsb); } return xmlConfig; }