@Email注解报红 是因为新版本需要validation启动器
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
Springboot2.3.0之后版本pom.xml改为:
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.0.17.Final</version>
<scope>compile</scope>
</dependency>
修改之后成功:


本文介绍了解决Spring Boot中使用@Email注解时出现的报错问题。从Spring Boot 2.3.0开始,需要在pom.xml文件中引入hibernate-validator依赖而非spring-boot-starter-validation。文中提供了具体的依赖配置示例。
6019

被折叠的 条评论
为什么被折叠?



