Skip to content

Commit 7b675fc

Browse files
committed
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
1 parent 566f570 commit 7b675fc

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

spring-boot-tools/spring-boot-loader/src/it/executable-props-lib/src/main/java/org/springframework/boot/launcher/it/props/SpringConfiguration.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
import java.io.IOException;
2020
import java.util.Properties;
2121

22-
import javax.annotation.PostConstruct;
23-
22+
import org.springframework.beans.factory.InitializingBean;
2423
import org.springframework.context.annotation.ComponentScan;
2524
import org.springframework.context.annotation.Configuration;
2625
import org.springframework.core.io.ClassPathResource;
@@ -32,12 +31,12 @@
3231
*/
3332
@Configuration
3433
@ComponentScan
35-
public class SpringConfiguration {
34+
public class SpringConfiguration implements InitializingBean {
3635

3736
private String message = "Jar";
3837

39-
@PostConstruct
40-
public void init() throws IOException {
38+
@Override
39+
public void afterPropertiesSet() throws IOException {
4140
Properties props = new Properties();
4241
props.load(new ClassPathResource("application.properties").getInputStream());
4342
String value = props.getProperty("message");

spring-boot-tools/spring-boot-loader/src/it/executable-props/src/main/java/org/springframework/launcher/it/props/SpringConfiguration.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
import java.io.IOException;
2020
import java.util.Properties;
2121

22-
import javax.annotation.PostConstruct;
23-
22+
import org.springframework.beans.factory.InitializingBean;
2423
import org.springframework.context.annotation.ComponentScan;
2524
import org.springframework.context.annotation.Configuration;
2625
import org.springframework.core.io.ClassPathResource;
@@ -32,12 +31,12 @@
3231
*/
3332
@Configuration
3433
@ComponentScan
35-
public class SpringConfiguration {
34+
public class SpringConfiguration implements InitializingBean {
3635

3736
private String message = "Jar";
3837

39-
@PostConstruct
40-
public void init() throws IOException {
38+
@Override
39+
public void afterPropertiesSet() throws IOException {
4140
Properties props = new Properties();
4241
props.load(new ClassPathResource("application.properties").getInputStream());
4342
String value = props.getProperty("message");

0 commit comments

Comments
 (0)