注解相关
喵行星
1
展开
-
JSR303校验
步骤1:使用校验注解在Java中提供了一系列的校验方式,它这些校验方式在“javax.validation.constraints”包中,提供了如@Email,@NotNull等注解。在非空处理方式上提供了@NotNull,@Blank和@(1)@NotNullThe annotated element must not be null. Accepts any type.注解元素禁止为null,能够接收任何类型(2)@NotEmptythe annotated element must no原创 2021-09-12 23:30:21 · 286 阅读 · 0 评论 -
校验 注解
@NotEmpty、@NotBlank和、@NotNull都来自于包org.hibernate.validator.constraints.*@NotNull:不能为null,但可以为empty,用在基本类型上@NotEmpty:不能为null,而且长度必须大于0,用在集合类上面@NotBlank:只能作用在String上,不能为null,而且调用trim()后,长度必须大于0...原创 2021-09-10 11:36:29 · 45 阅读 · 0 评论 -
EnableConfigurationProperties
@EnableConfigurationProperties(VslProperties.class)如果一个配置类只配置@ConfigurationProperties注解,而没有使用@Component,那么在IOC容器中是获取不到properties 配置文件转化的bean。@EnableConfigurationProperties 是把指定类的属性又注入了一次。...原创 2021-09-10 11:35:54 · 290 阅读 · 0 评论