I have a java spring project with the below service:
@Slf4j
public class DialogFlowService {
private String projectId;
private String sessionId;
private String languageCode;
public DialogFlowService(DialogFlowConfig dialogFlowConfig) {
log.info("aaa" + dialogFlowConfig.languageCode);
this.projectId = dialogFlowConfig.projectId;
this.sessionId = dialogFlowConfig.sessionId;
this.languageCode = dialogFlowConfig.languageCode;
}
}
The constructor takes the below class as an argument:
@Configuration
@ConfigurationProperties(prefix = "dialog-flow")
public class DialogFlowConfig {
@NotNull
public String projectId;
@NotNull
public String sessionId;
@NotNull
public String languageCode;
}
In theory, this should be instantiated by the below bean:
@Bean
public DialogFlowService dialogFlowService() {
return new DialogFlowService(new DialogFlowConfig());
}
However in practice, when I try to log one of the constructor arguments, it comes up as null. Am I missing something?