fixing formatting
This commit is contained in:
+18
-18
@@ -2,27 +2,27 @@ package com.baeldung.boot.configurationproperties;
|
||||
|
||||
public class Credentials {
|
||||
|
||||
private String username;
|
||||
private String password;
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
public Credentials(String username, String password) {
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
public Credentials(String username, String password) {
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -8,9 +8,9 @@ import org.springframework.stereotype.Component;
|
||||
@ConfigurationPropertiesBinding
|
||||
public class CustomCredentialsConverter implements Converter<String, Credentials> {
|
||||
|
||||
@Override
|
||||
public Credentials convert(String source) {
|
||||
String data[] = source.split(",");
|
||||
return new Credentials(data[0], data[1]);
|
||||
}
|
||||
@Override
|
||||
public Credentials convert(String source) {
|
||||
String[] data = source.split(",");
|
||||
return new Credentials(data[0], data[1]);
|
||||
}
|
||||
}
|
||||
|
||||
+28
-28
@@ -19,41 +19,41 @@ import org.springframework.validation.annotation.Validated;
|
||||
@Validated
|
||||
public class MailServer {
|
||||
|
||||
@NotNull
|
||||
@NotEmpty
|
||||
private Map<String, @NotBlank String> propertiesMap;
|
||||
@NotNull
|
||||
@NotEmpty
|
||||
private Map<String, @NotBlank String> propertiesMap;
|
||||
|
||||
@Valid
|
||||
private MailConfig mailConfig = new MailConfig();
|
||||
@Valid
|
||||
private MailConfig mailConfig = new MailConfig();
|
||||
|
||||
public static class MailConfig {
|
||||
public static class MailConfig {
|
||||
|
||||
@NotBlank
|
||||
@Email
|
||||
private String address;
|
||||
@NotBlank
|
||||
@Email
|
||||
private String address;
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
}
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, String> getPropertiesMap() {
|
||||
return propertiesMap;
|
||||
}
|
||||
public Map<String, String> getPropertiesMap() {
|
||||
return propertiesMap;
|
||||
}
|
||||
|
||||
public void setPropertiesMap(Map<String, String> propertiesMap) {
|
||||
this.propertiesMap = propertiesMap;
|
||||
}
|
||||
public void setPropertiesMap(Map<String, String> propertiesMap) {
|
||||
this.propertiesMap = propertiesMap;
|
||||
}
|
||||
|
||||
public MailConfig getMailConfig() {
|
||||
return mailConfig;
|
||||
}
|
||||
public MailConfig getMailConfig() {
|
||||
return mailConfig;
|
||||
}
|
||||
|
||||
public void setMailConfig(MailConfig mailConfig) {
|
||||
this.mailConfig = mailConfig;
|
||||
}
|
||||
public void setMailConfig(MailConfig mailConfig) {
|
||||
this.mailConfig = mailConfig;
|
||||
}
|
||||
}
|
||||
+37
-37
@@ -13,55 +13,55 @@ import org.springframework.util.unit.DataUnit;
|
||||
@ConfigurationProperties(prefix = "server")
|
||||
public class PropertyConversion {
|
||||
|
||||
private DataSize uploadSpeed;
|
||||
private DataSize uploadSpeed;
|
||||
|
||||
@DataSizeUnit(DataUnit.GIGABYTES)
|
||||
private DataSize downloadSpeed;
|
||||
@DataSizeUnit(DataUnit.GIGABYTES)
|
||||
private DataSize downloadSpeed;
|
||||
|
||||
private Duration backupDay;
|
||||
private Duration backupDay;
|
||||
|
||||
@DurationUnit(ChronoUnit.HOURS)
|
||||
private Duration backupHour;
|
||||
@DurationUnit(ChronoUnit.HOURS)
|
||||
private Duration backupHour;
|
||||
|
||||
private Credentials credentials;
|
||||
private Credentials credentials;
|
||||
|
||||
public Duration getBackupDay() {
|
||||
return backupDay;
|
||||
}
|
||||
public Duration getBackupDay() {
|
||||
return backupDay;
|
||||
}
|
||||
|
||||
public void setBackupDay(Duration backupDay) {
|
||||
this.backupDay = backupDay;
|
||||
}
|
||||
public void setBackupDay(Duration backupDay) {
|
||||
this.backupDay = backupDay;
|
||||
}
|
||||
|
||||
public Duration getBackupHour() {
|
||||
return backupHour;
|
||||
}
|
||||
public Duration getBackupHour() {
|
||||
return backupHour;
|
||||
}
|
||||
|
||||
public void setBackupHour(Duration backupHour) {
|
||||
this.backupHour = backupHour;
|
||||
}
|
||||
public void setBackupHour(Duration backupHour) {
|
||||
this.backupHour = backupHour;
|
||||
}
|
||||
|
||||
public DataSize getUploadSpeed() {
|
||||
return uploadSpeed;
|
||||
}
|
||||
public DataSize getUploadSpeed() {
|
||||
return uploadSpeed;
|
||||
}
|
||||
|
||||
public void setUploadSpeed(DataSize uploadSpeed) {
|
||||
this.uploadSpeed = uploadSpeed;
|
||||
}
|
||||
public void setUploadSpeed(DataSize uploadSpeed) {
|
||||
this.uploadSpeed = uploadSpeed;
|
||||
}
|
||||
|
||||
public DataSize getDownloadSpeed() {
|
||||
return downloadSpeed;
|
||||
}
|
||||
public DataSize getDownloadSpeed() {
|
||||
return downloadSpeed;
|
||||
}
|
||||
|
||||
public void setDownloadSpeed(DataSize downloadSpeed) {
|
||||
this.downloadSpeed = downloadSpeed;
|
||||
}
|
||||
public void setDownloadSpeed(DataSize downloadSpeed) {
|
||||
this.downloadSpeed = downloadSpeed;
|
||||
}
|
||||
|
||||
public Credentials getCredentials() {
|
||||
return credentials;
|
||||
}
|
||||
public Credentials getCredentials() {
|
||||
return credentials;
|
||||
}
|
||||
|
||||
public void setCredentials(Credentials credentials) {
|
||||
this.credentials = credentials;
|
||||
}
|
||||
public void setCredentials(Credentials credentials) {
|
||||
this.credentials = credentials;
|
||||
}
|
||||
}
|
||||
|
||||
+23
-23
@@ -9,35 +9,35 @@ import org.springframework.context.annotation.Configuration;
|
||||
@ConfigurationProperties(prefix = "server")
|
||||
public class ServerConfig {
|
||||
|
||||
private Address address;
|
||||
private Map<String, String> resourcesPath;
|
||||
private Address address;
|
||||
private Map<String, String> resourcesPath;
|
||||
|
||||
public static class Address {
|
||||
public static class Address {
|
||||
|
||||
private String ip;
|
||||
private String ip;
|
||||
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
}
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
}
|
||||
|
||||
public Address getAddress() {
|
||||
return address;
|
||||
}
|
||||
public Address getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(Address address) {
|
||||
this.address = address;
|
||||
}
|
||||
public void setAddress(Address address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public Map<String, String> getResourcesPath() {
|
||||
return resourcesPath;
|
||||
}
|
||||
public Map<String, String> getResourcesPath() {
|
||||
return resourcesPath;
|
||||
}
|
||||
|
||||
public void setResourcesPath(Map<String, String> resourcesPath) {
|
||||
this.resourcesPath = resourcesPath;
|
||||
}
|
||||
public void setResourcesPath(Map<String, String> resourcesPath) {
|
||||
this.resourcesPath = resourcesPath;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -7,9 +7,9 @@ import org.springframework.context.annotation.Configuration;
|
||||
@Configuration
|
||||
public class ServerConfigFactory {
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties(prefix = "server.default")
|
||||
public ServerConfig getDefaultConfigs() {
|
||||
return new ServerConfig();
|
||||
}
|
||||
@Bean
|
||||
@ConfigurationProperties(prefix = "server.default")
|
||||
public ServerConfig getDefaultConfigs() {
|
||||
return new ServerConfig();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user