WIP
authorKai Moritz <kai@juplo.de>
Fri, 20 Nov 2020 22:55:33 +0000 (23:55 +0100)
committerKai Moritz <kai@juplo.de>
Fri, 20 Nov 2020 22:55:33 +0000 (23:55 +0100)
src/main/java/de/juplo/demos/multiplebeans/MultipleBeansEnvironmentPostProcessor.java [new file with mode: 0644]
src/main/resources/META-INF/spring.factories
src/main/resources/application.yml

diff --git a/src/main/java/de/juplo/demos/multiplebeans/MultipleBeansEnvironmentPostProcessor.java b/src/main/java/de/juplo/demos/multiplebeans/MultipleBeansEnvironmentPostProcessor.java
new file mode 100644 (file)
index 0000000..132f6ee
--- /dev/null
@@ -0,0 +1,20 @@
+package de.juplo.demos.multiplebeans;
+
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.env.EnvironmentPostProcessor;
+import org.springframework.core.env.ConfigurableEnvironment;
+import org.springframework.core.env.PropertySource;
+
+import java.util.regex.Pattern;
+
+public class MultipleBeansEnvironmentPostProcessor implements EnvironmentPostProcessor {
+    public final static Pattern PATTERN = Pattern.compile("juplo\\.sites\\[([0-9]+)\\]\\.(.+)");
+
+    @Override
+    public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
+        for (PropertySource source : environment.getPropertySources()) {
+            System.out.println(source.getName());
+        }
+    }
+}
index 5c9c458..05adff8 100644 (file)
@@ -1 +1 @@
-org.springframework.context.ApplicationContextInitializer=de.juplo.demos.multiplebeans.MultipleBeansApplicationContextInitializer
+org.springframework.boot.env.EnvironmentPostProcessor=de.juplo.demos.multiplebeans.MultipleBeansEnvironmentPostProcessor
\ No newline at end of file
index 04397c1..87bec8d 100644 (file)
@@ -3,4 +3,7 @@ juplo:
   sites:
     - name: peter
       description: This is the Home-Page of PETER
-      
+    - name: ute
+      description: My name is Ute. I like cats!
+    - name: franz
+      description: Franz was here!