From 7b675fc53e32408c1a3bf11284fa01ce18fc7882 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Mon, 25 Sep 2017 15:51:36 +0200 Subject: [PATCH] Make spring-boot-loader its Java 9 friendly This commit updates the integration tests of "spring-boot-loader" to not use `@PostConstruct` but rather `InitializingBean` Closes gh-10274 --- .../boot/launcher/it/props/SpringConfiguration.java | 9 ++++----- .../launcher/it/props/SpringConfiguration.java | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/spring-boot-tools/spring-boot-loader/src/it/executable-props-lib/src/main/java/org/springframework/boot/launcher/it/props/SpringConfiguration.java b/spring-boot-tools/spring-boot-loader/src/it/executable-props-lib/src/main/java/org/springframework/boot/launcher/it/props/SpringConfiguration.java index f05bae73fd..6e475213c9 100644 --- a/spring-boot-tools/spring-boot-loader/src/it/executable-props-lib/src/main/java/org/springframework/boot/launcher/it/props/SpringConfiguration.java +++ b/spring-boot-tools/spring-boot-loader/src/it/executable-props-lib/src/main/java/org/springframework/boot/launcher/it/props/SpringConfiguration.java @@ -19,8 +19,7 @@ package org.springframework.boot.launcher.it.props; import java.io.IOException; import java.util.Properties; -import javax.annotation.PostConstruct; - +import org.springframework.beans.factory.InitializingBean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.ClassPathResource; @@ -32,12 +31,12 @@ import org.springframework.core.io.ClassPathResource; */ @Configuration @ComponentScan -public class SpringConfiguration { +public class SpringConfiguration implements InitializingBean { private String message = "Jar"; - @PostConstruct - public void init() throws IOException { + @Override + public void afterPropertiesSet() throws IOException { Properties props = new Properties(); props.load(new ClassPathResource("application.properties").getInputStream()); String value = props.getProperty("message"); diff --git a/spring-boot-tools/spring-boot-loader/src/it/executable-props/src/main/java/org/springframework/launcher/it/props/SpringConfiguration.java b/spring-boot-tools/spring-boot-loader/src/it/executable-props/src/main/java/org/springframework/launcher/it/props/SpringConfiguration.java index 5f41c18250..23e1bbdef5 100644 --- a/spring-boot-tools/spring-boot-loader/src/it/executable-props/src/main/java/org/springframework/launcher/it/props/SpringConfiguration.java +++ b/spring-boot-tools/spring-boot-loader/src/it/executable-props/src/main/java/org/springframework/launcher/it/props/SpringConfiguration.java @@ -19,8 +19,7 @@ package org.springframework.boot.load.it.props; import java.io.IOException; import java.util.Properties; -import javax.annotation.PostConstruct; - +import org.springframework.beans.factory.InitializingBean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.ClassPathResource; @@ -32,12 +31,12 @@ import org.springframework.core.io.ClassPathResource; */ @Configuration @ComponentScan -public class SpringConfiguration { +public class SpringConfiguration implements InitializingBean { private String message = "Jar"; - @PostConstruct - public void init() throws IOException { + @Override + public void afterPropertiesSet() throws IOException { Properties props = new Properties(); props.load(new ClassPathResource("application.properties").getInputStream()); String value = props.getProperty("message");