JAVA-23896 Clarify "Guide to @ConfigurationProperties in Spring Boot" article (#14642)
This commit is contained in:
parent
89fa14a69b
commit
86cb1e4baa
@ -1,6 +1,7 @@
|
|||||||
package com.baeldung.configurationproperties;
|
package com.baeldung.configurationproperties;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.boot.context.properties.bind.ConstructorBinding;
|
||||||
|
|
||||||
@ConfigurationProperties(prefix = "mail.credentials")
|
@ConfigurationProperties(prefix = "mail.credentials")
|
||||||
public class ImmutableCredentials {
|
public class ImmutableCredentials {
|
||||||
@ -9,12 +10,19 @@ public class ImmutableCredentials {
|
|||||||
private final String username;
|
private final String username;
|
||||||
private final String password;
|
private final String password;
|
||||||
|
|
||||||
|
@ConstructorBinding
|
||||||
public ImmutableCredentials(String authMethod, String username, String password) {
|
public ImmutableCredentials(String authMethod, String username, String password) {
|
||||||
this.authMethod = authMethod;
|
this.authMethod = authMethod;
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ImmutableCredentials(String username, String password) {
|
||||||
|
this.username = username;
|
||||||
|
this.password = password;
|
||||||
|
this.authMethod = "Default";
|
||||||
|
}
|
||||||
|
|
||||||
public String getAuthMethod() {
|
public String getAuthMethod() {
|
||||||
return authMethod;
|
return authMethod;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user