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
This commit is contained in:
parent
566f570d96
commit
7b675fc53e
|
|
@ -19,8 +19,7 @@ package org.springframework.boot.launcher.it.props;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Properties;
|
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.ComponentScan;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
@ -32,12 +31,12 @@ import org.springframework.core.io.ClassPathResource;
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@ComponentScan
|
@ComponentScan
|
||||||
public class SpringConfiguration {
|
public class SpringConfiguration implements InitializingBean {
|
||||||
|
|
||||||
private String message = "Jar";
|
private String message = "Jar";
|
||||||
|
|
||||||
@PostConstruct
|
@Override
|
||||||
public void init() throws IOException {
|
public void afterPropertiesSet() throws IOException {
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
props.load(new ClassPathResource("application.properties").getInputStream());
|
props.load(new ClassPathResource("application.properties").getInputStream());
|
||||||
String value = props.getProperty("message");
|
String value = props.getProperty("message");
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,7 @@ package org.springframework.boot.load.it.props;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Properties;
|
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.ComponentScan;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
@ -32,12 +31,12 @@ import org.springframework.core.io.ClassPathResource;
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@ComponentScan
|
@ComponentScan
|
||||||
public class SpringConfiguration {
|
public class SpringConfiguration implements InitializingBean {
|
||||||
|
|
||||||
private String message = "Jar";
|
private String message = "Jar";
|
||||||
|
|
||||||
@PostConstruct
|
@Override
|
||||||
public void init() throws IOException {
|
public void afterPropertiesSet() throws IOException {
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
props.load(new ClassPathResource("application.properties").getInputStream());
|
props.load(new ClassPathResource("application.properties").getInputStream());
|
||||||
String value = props.getProperty("message");
|
String value = props.getProperty("message");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue