JAVA-23896 Clarify "Guide to @ConfigurationProperties in Spring Boot" article (#14642)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user