多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
**1.校验依赖** ~~~ <!-- 引入校验模块 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-validation</artifactId> </dependency> ~~~ **2.配置修改** ~~~ person: firstName: tom lastName: cat age: 110 married: false birthday: 1991/03/19 map: {key1: v1, key2: v2} list: - tom - jerry - jack - rose set: - name: hanmeimei age: 18 - name: hanmeimei age: 18 user: name: nobb age: 25 ~~~ **3.配置实体开启校验,需要@ConfigurationProperties配合@Validated** ~~~ @Component //自动属性注入,需要set方法 @ConfigurationProperties(prefix = "person") @Validated public class Person { ~~~