Skip to content

Commit 8ced838

Browse files
committed
Set entity resolver hint and init geotools in the application
1 parent f7b9b33 commit 8ced838

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

src/main/java/org/tailormap/api/TailormapApiApplication.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66

77
package org.tailormap.api;
88

9+
import org.geotools.util.factory.GeoTools;
910
import org.springframework.boot.SpringApplication;
1011
import org.springframework.boot.autoconfigure.SpringBootApplication;
1112

1213
@SpringBootApplication(scanBasePackages = {"org.tailormap.api.configuration.base"})
1314
public class TailormapApiApplication {
14-
public static void main(String[] args) {
15+
static void main(String[] args) {
16+
GeoTools.init();
1517
SpringApplication.run(TailormapApiApplication.class, args);
1618
}
1719
}

src/main/java/org/tailormap/api/geotools/featuresources/WFSFeatureSourceHelper.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import org.geotools.data.wfs.WFSDataStoreFactory;
1616
import org.geotools.data.wfs.internal.FeatureTypeInfo;
1717
import org.geotools.util.PreventLocalEntityResolver;
18+
import org.geotools.util.factory.Hints;
1819
import org.springframework.util.LinkedCaseInsensitiveMap;
1920
import org.springframework.web.util.UriComponentsBuilder;
2021
import org.tailormap.api.geotools.wfs.SimpleWFSHelper;
@@ -30,6 +31,8 @@ public DataStore createDataStore(TMFeatureSource tmfs, Integer timeout) throws I
3031
Map<String, Object> params = new HashMap<>();
3132
params.put(WFSDataStoreFactory.ENTITY_RESOLVER.key, PreventLocalEntityResolver.INSTANCE);
3233

34+
Hints.putSystemDefault(Hints.ENTITY_RESOLVER, params.get(WFSDataStoreFactory.ENTITY_RESOLVER.key));
35+
3336
if (timeout != null) {
3437
params.put(WFSDataStoreFactory.TIMEOUT.key, timeout);
3538
}

0 commit comments

Comments
 (0)