NullPointerException when binding ConfigurationProperties (Spring Boot)

I am struggling with some code and I don't have a clue why...

Here is my code:

@SpringBootApplication

@EnableConfigurationProperties(WorkflowRootProperties.class)

@ComponentScan

@ActiveProfiles("test")

public class TestApplication {

public static void main(String[] args) {

SpringApplication.run(TestApplication.class, args);

}

}

And my properties bean

@ConfigurationProperties("workflow")

public class WorkflowRootProperties {

private List datacenter = new ArrayList<>();

public List getDatacenter() {

return datacenter;

}

public void setDatacenter(List datacenter) {

this.datacenter = datacenter;

}

}

Which references another bean

public class EnvProperties {

public static class Datacenter {

private List env = new ArrayList<>();

public List getEnv() {

return env;

}

public void setEnv(List env) {

this.env = env;

}

}

public static class Env {

private List instance = new ArrayList<>();

public List getInstance() {

return instance;

}

public void setInstance(List instance) {

this.instance =...

Read More »

By: StackOverFlow - Tuesday, 13 March

Related Posts