From c0b36de3cfebf57fe05be1c4f08081c87fdeeb8d Mon Sep 17 00:00:00 2001 From: spencergibb Date: Thu, 28 May 2020 16:16:36 -0400 Subject: [PATCH] Removes use of javax.validation --- pom.xml | 2 +- .../zookeeper/config/ZookeeperConfigProperties.java | 9 +++------ .../cloud/zookeeper/ZookeeperProperties.java | 7 ++----- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index 66a886bb..060bbbc9 100644 --- a/pom.xml +++ b/pom.xml @@ -177,7 +177,7 @@ - 2.2.3.RELEASE + 2.3.0.BUILD-SNAPSHOT 2.2.3.BUILD-SNAPSHOT 2.2.3.BUILD-SNAPSHOT 2.2.3.BUILD-SNAPSHOT diff --git a/spring-cloud-zookeeper-config/src/main/java/org/springframework/cloud/zookeeper/config/ZookeeperConfigProperties.java b/spring-cloud-zookeeper-config/src/main/java/org/springframework/cloud/zookeeper/config/ZookeeperConfigProperties.java index 14e120e5..776a08b0 100644 --- a/spring-cloud-zookeeper-config/src/main/java/org/springframework/cloud/zookeeper/config/ZookeeperConfigProperties.java +++ b/spring-cloud-zookeeper-config/src/main/java/org/springframework/cloud/zookeeper/config/ZookeeperConfigProperties.java @@ -16,10 +16,8 @@ package org.springframework.cloud.zookeeper.config; -import javax.validation.constraints.NotEmpty; - import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.validation.annotation.Validated; +import org.springframework.util.Assert; /** * Properties related to keeping configuration in Zookeeper. @@ -28,7 +26,6 @@ import org.springframework.validation.annotation.Validated; * @since 1.0.0 * @see ZookeeperPropertySourceLocator */ -@Validated @ConfigurationProperties("spring.cloud.zookeeper.config") public class ZookeeperConfigProperties { @@ -42,13 +39,11 @@ public class ZookeeperConfigProperties { /** * The name of the default context. */ - @NotEmpty private String defaultContext = "application"; /** * Separator for profile appended to the application name. */ - @NotEmpty private String profileSeparator = ","; /** @@ -85,10 +80,12 @@ public class ZookeeperConfigProperties { } public void setDefaultContext(String defaultContext) { + Assert.hasText(defaultContext, "spring.cloud.zookeeper.config.default-context may not be empty"); this.defaultContext = defaultContext; } public void setProfileSeparator(String profileSeparator) { + Assert.hasText(profileSeparator, "spring.cloud.zookeeper.config.profile-separator may not be empty"); this.profileSeparator = profileSeparator; } diff --git a/spring-cloud-zookeeper-core/src/main/java/org/springframework/cloud/zookeeper/ZookeeperProperties.java b/spring-cloud-zookeeper-core/src/main/java/org/springframework/cloud/zookeeper/ZookeeperProperties.java index b53f93a5..9fee5421 100644 --- a/spring-cloud-zookeeper-core/src/main/java/org/springframework/cloud/zookeeper/ZookeeperProperties.java +++ b/spring-cloud-zookeeper-core/src/main/java/org/springframework/cloud/zookeeper/ZookeeperProperties.java @@ -20,11 +20,9 @@ import java.time.Duration; import java.time.temporal.ChronoUnit; import java.util.concurrent.TimeUnit; -import javax.validation.constraints.NotNull; - import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.convert.DurationUnit; -import org.springframework.validation.annotation.Validated; +import org.springframework.util.Assert; /** * Properties related to connecting to Zookeeper. @@ -32,14 +30,12 @@ import org.springframework.validation.annotation.Validated; * @author Spencer Gibb * @since 1.0.0 */ -@Validated @ConfigurationProperties("spring.cloud.zookeeper") public class ZookeeperProperties { /** * Connection string to the Zookeeper cluster. */ - @NotNull private String connectString = "localhost:2181"; /** @@ -118,6 +114,7 @@ public class ZookeeperProperties { } public void setConnectString(String connectString) { + Assert.hasText(connectString, "spring.cloud.zookeeper.connect-string may not be empty"); this.connectString = connectString; }