错误提示1
提示org.hibernate.validator.constraints程序包找不到
原因:从2.3起官方已将validation
库移除。参考:https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.3-Release-Notes#validation-starter-no-longer-included-in-web-starters
解决办法:
只需要在pom.xml
中加入如下依赖库即可
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
错误提示2
org.springframework.boot.context.config.InactiveConfigDataAccessException: Inactive property source ‘Config resource ‘class path resource [application.properties]’ via location ‘optional: classpath:/‘’ imported from location ‘class path resource [application.properties]’ cannot contain property ‘spring.profiles.active’ [origin: class path resource [application.properties]
原因:新版本Spring Boot已将spring.profiles
配置弃用。
解决办法:
将旧的配置
spring.profiles.active=dev
修改为如下配置即可
spring.config.activate.on-profile=dev