对于非常简单的配置类,我不断收到验证器错误
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.NotBlank;
@Component
@Data
@Validated
@ConfigurationProperties(prefix = "test")
public class TestProperties {
@NotBlank
String uri;
}
错误是自我解释:
javax.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint 'javax.validation.constraints.NotBlank' validating type 'java.lang.String'. Check configuration for 'uri'
但是根据spring boot文档,这应该可以。