JAVA-23896 Clarify "Guide to @ConfigurationProperties in Spring Boot" article (#14642)

This commit is contained in:
timis1
2023-08-25 11:21:50 +03:00
committed by GitHub
parent 9689957cef
commit 0a87bede16

View File

@@ -1,6 +1,7 @@
package com.baeldung.configurationproperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.bind.ConstructorBinding;
@ConfigurationProperties(prefix = "mail.credentials")
public class ImmutableCredentials {
@@ -9,12 +10,19 @@ public class ImmutableCredentials {
private final String username;
private final String password;
@ConstructorBinding
public ImmutableCredentials(String authMethod, String username, String password) {
this.authMethod = authMethod;
this.username = username;
this.password = password;
}
public ImmutableCredentials(String username, String password) {
this.username = username;
this.password = password;
this.authMethod = "Default";
}
public String getAuthMethod() {
return authMethod;
}