Annotate Vault…Properties with @Validated to enable property validation.
Closes gh-96.
This commit is contained in:
@@ -15,11 +15,12 @@
|
||||
*/
|
||||
package org.springframework.cloud.vault.config.aws;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.cloud.vault.config.VaultSecretBackendDescriptor;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
/**
|
||||
* Configuration properties for Vault using the AWS integration.
|
||||
@@ -28,6 +29,7 @@ import lombok.Data;
|
||||
*/
|
||||
@ConfigurationProperties("spring.cloud.vault.aws")
|
||||
@Data
|
||||
@Validated
|
||||
public class VaultAwsProperties implements VaultSecretBackendDescriptor {
|
||||
|
||||
/**
|
||||
@@ -57,4 +59,4 @@ public class VaultAwsProperties implements VaultSecretBackendDescriptor {
|
||||
*/
|
||||
@NotEmpty
|
||||
private String secretKeyProperty = "cloud.aws.credentials.secretKey";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,11 +15,12 @@
|
||||
*/
|
||||
package org.springframework.cloud.vault.config.consul;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.cloud.vault.config.VaultSecretBackendDescriptor;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
/**
|
||||
* Configuration properties for HashiCorp Consul.
|
||||
@@ -28,6 +29,7 @@ import lombok.Data;
|
||||
*/
|
||||
@ConfigurationProperties("spring.cloud.vault.consul")
|
||||
@Data
|
||||
@Validated
|
||||
public class VaultConsulProperties implements VaultSecretBackendDescriptor {
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,10 +15,11 @@
|
||||
*/
|
||||
package org.springframework.cloud.vault.config.databases;
|
||||
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
/**
|
||||
* Configuration properties for Vault using the Apache Cassandra integration.
|
||||
@@ -27,6 +28,7 @@ import lombok.Data;
|
||||
*/
|
||||
@ConfigurationProperties("spring.cloud.vault.cassandra")
|
||||
@Data
|
||||
@Validated
|
||||
public class VaultCassandraProperties implements DatabaseSecretProperties {
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,10 +15,11 @@
|
||||
*/
|
||||
package org.springframework.cloud.vault.config.databases;
|
||||
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
/**
|
||||
* Configuration properties for Vault using the MongoDB integration.
|
||||
@@ -27,6 +28,7 @@ import lombok.Data;
|
||||
*/
|
||||
@ConfigurationProperties("spring.cloud.vault.mongodb")
|
||||
@Data
|
||||
@Validated
|
||||
public class VaultMongoProperties implements DatabaseSecretProperties {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package org.springframework.cloud.vault.config.databases;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.cloud.vault.config.VaultSecretBackendDescriptor;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
/**
|
||||
* Configuration properties for Vault using the MySQL integration.
|
||||
@@ -13,6 +14,7 @@ import lombok.Data;
|
||||
*/
|
||||
@ConfigurationProperties("spring.cloud.vault.mysql")
|
||||
@Data
|
||||
@Validated
|
||||
public class VaultMySqlProperties
|
||||
implements DatabaseSecretProperties, VaultSecretBackendDescriptor {
|
||||
|
||||
|
||||
@@ -15,10 +15,11 @@
|
||||
*/
|
||||
package org.springframework.cloud.vault.config.databases;
|
||||
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
/**
|
||||
* Configuration properties for Vault using the PostgreSQL integration.
|
||||
@@ -27,6 +28,7 @@ import lombok.Data;
|
||||
*/
|
||||
@ConfigurationProperties("spring.cloud.vault.postgresql")
|
||||
@Data
|
||||
@Validated
|
||||
public class VaultPostgreSqlProperties implements DatabaseSecretProperties {
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,11 +15,12 @@
|
||||
*/
|
||||
package org.springframework.cloud.vault.config.rabbitmq;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.cloud.vault.config.VaultSecretBackendDescriptor;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
/**
|
||||
* Configuration properties for Vault using the RabbitMQ integration.
|
||||
@@ -28,6 +29,7 @@ import lombok.Data;
|
||||
*/
|
||||
@ConfigurationProperties("spring.cloud.vault.rabbitmq")
|
||||
@Data
|
||||
@Validated
|
||||
public class VaultRabbitMqProperties implements VaultSecretBackendDescriptor {
|
||||
|
||||
/**
|
||||
@@ -57,4 +59,4 @@ public class VaultRabbitMqProperties implements VaultSecretBackendDescriptor {
|
||||
*/
|
||||
@NotEmpty
|
||||
private String passwordProperty = "spring.rabbitmq.password";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.EnvironmentAware;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
/**
|
||||
* Configuration properties for Vault using the generic backend.
|
||||
@@ -31,6 +32,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
@ConfigurationProperties("spring.cloud.vault.generic")
|
||||
@Data
|
||||
@Validated
|
||||
public class VaultGenericBackendProperties implements EnvironmentAware {
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.springframework.context.EnvironmentAware;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
/**
|
||||
* @author Spencer Gibb
|
||||
@@ -33,6 +34,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
@ConfigurationProperties("spring.cloud.vault")
|
||||
@Data
|
||||
@Validated
|
||||
public class VaultProperties implements EnvironmentAware {
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user