From b4e54596c01dd921c87de7c6ea1f837b66a61ea0 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sat, 16 Jan 2021 10:50:02 +0100 Subject: [PATCH] WIP --- .../HttpResourcesDemoApplication.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/de/juplo/demo/httpresources/HttpResourcesDemoApplication.java b/src/main/java/de/juplo/demo/httpresources/HttpResourcesDemoApplication.java index aec1079..f839e27 100644 --- a/src/main/java/de/juplo/demo/httpresources/HttpResourcesDemoApplication.java +++ b/src/main/java/de/juplo/demo/httpresources/HttpResourcesDemoApplication.java @@ -1,8 +1,11 @@ package de.juplo.demo.httpresources; +import de.juplo.httpresources.HttpResourceChainAwareResourceLoader; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; +import org.springframework.context.support.GenericApplicationContext; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.http.client.ClientHttpRequestFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; @@ -16,6 +19,19 @@ public class HttpResourcesDemoApplication return new HttpComponentsClientHttpRequestFactory(); } + @Bean + HttpResourceChainAwareResourceLoader resourceLoader( + GenericApplicationContext context, + String[] sources) { + HttpResourceChainAwareResourceLoader loader = + new HttpResourceChainAwareResourceLoader( + new PathMatchingResourcePatternResolver(), + sources + ); + context.setResourceLoader(loader); + return loader; + } + public static void main(String[] args) { -- 2.20.1