diff --git a/services/src/main/java/org/fao/geonet/api/records/formatters/FormatterApi.java b/services/src/main/java/org/fao/geonet/api/records/formatters/FormatterApi.java index 83913e5efa6..888fa0daaf8 100644 --- a/services/src/main/java/org/fao/geonet/api/records/formatters/FormatterApi.java +++ b/services/src/main/java/org/fao/geonet/api/records/formatters/FormatterApi.java @@ -551,7 +551,7 @@ private String getXmlFromUrl(ServiceContext context, String lang, String url, We adjustedUrl = context.getBean(SettingManager.class).getSiteURL(lang) + url; } else { final URI uri = new URI(url); - Set allowedRemoteHosts = context.getBean("formatterRemoteFormatAllowedHosts", Set.class); + Set allowedRemoteHosts = ApplicationContextHolder.get().getBean("formatterRemoteFormatAllowedHosts", Set.class); Assert.isTrue(allowedRemoteHosts.contains(uri.getHost()), "xml.format is not allowed to make requests to " + uri.getHost()); }