From: Kai Moritz Date: Fri, 20 Nov 2020 21:58:27 +0000 (+0100) Subject: WIP X-Git-Tag: wip-implementation~5 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=04821a0a85c63c923bdd839c49fcc3aaf2ef27c2;p=demos%2Fmultiple-beans WIP --- diff --git a/src/main/java/de/juplo/demos/multiplebeans/MultipleBeansApplication.java b/src/main/java/de/juplo/demos/multiplebeans/MultipleBeansApplication.java index cafcacf..7da4fa0 100644 --- a/src/main/java/de/juplo/demos/multiplebeans/MultipleBeansApplication.java +++ b/src/main/java/de/juplo/demos/multiplebeans/MultipleBeansApplication.java @@ -7,6 +7,7 @@ import org.springframework.context.annotation.Bean; @SpringBootApplication @EnableConfigurationProperties(MultipleBeansProperties.class) +@ContextConfiguration() public class MultipleBeansApplication { @Bean(name = "/peter") diff --git a/src/main/java/de/juplo/demos/multiplebeans/MultipleBeansApplicationContextInitializer.java b/src/main/java/de/juplo/demos/multiplebeans/MultipleBeansApplicationContextInitializer.java new file mode 100644 index 0000000..f6d4ecf --- /dev/null +++ b/src/main/java/de/juplo/demos/multiplebeans/MultipleBeansApplicationContextInitializer.java @@ -0,0 +1,16 @@ +package de.juplo.demos.multiplebeans; + +import org.springframework.context.ApplicationContextInitializer; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.stereotype.Component; + +public class MultipleBeansApplicationContextInitializer + implements + ApplicationContextInitializer { + + @Override + public void initialize(ConfigurableApplicationContext context) { + MultipleBeansProperties properties = context.getBean(MultipleBeansProperties.class); + System.out.println(properties.project); + } +}