I have created a WebserviceCredentials class for config as below and used @autowired for WebserviceCredentials in a @component class it does not work (shows null values) , but when used in @restcontroller class it works, appreciate your help
@Component
@ConfigurationProperties(prefix="webservice")
public class WebserviceCredentials {
@Value("${webservice.EndPoint}")
private String webserviceEndpoint;
@Value("${webservice.Username}")
private String username;
@Value("${webservice.Password}")
private String password;
public String getwebserviceEndpoint() {
return webserviceEndpoint;
}
public void setwebserviceEndpoint(String webserviceEndpoint) {
this.webserviceEndpoint = webserviceEndpoint;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}