springboot 2.3之后消失的hibernate-validator解決方法
項(xiàng)目升級(jí)到springboot2.3之后,參數(shù)校驗(yàn)的注解報(bào)錯(cuò),發(fā)現(xiàn)spring-boot-starter-web的依賴項(xiàng)已經(jīng)去除了依賴
點(diǎn)開spring-boot-starter-web源碼看了下。
<?xml version="1.0" encoding="UTF-8"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <!-- This module was also published with a richer model, Gradle metadata, --> <!-- which should be used instead. Do not delete the following line which --> <!-- is to indicate to Gradle or any Gradle module metadata file consumer --> <!-- that they should prefer consuming it instead. --> <!-- do_not_remove: published-with-gradle-metadata --> <modelVersion>4.0.0</modelVersion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version>2.3.1.RELEASE</version> <name>spring-boot-starter-web</name> <description>Starter for building web, including RESTful, applications using Spring MVC. Uses Tomcat as the default embedded container</description> <url>https://spring.io/projects/spring-boot</url> <organization> <name>Pivotal Software, Inc.</name> <url>https://spring.io</url> </organization> <licenses> <license> <name>Apache License, Version 2.0</name> <url>https://www.apache.org/licenses/LICENSE-2.0</url> </license> </licenses> <developers> <developer> <name>Pivotal</name> <email>info@pivotal.io</email> <organization>Pivotal Software, Inc.</organization> <organizationUrl>https://www.spring.io</organizationUrl> </developer> </developers> <scm> <connection>scm:git:git://github.com/spring-projects/spring-boot.git</connection> <developerConnection>scm:git:ssh://git@github.com/spring-projects/spring-boot.git</developerConnection> <url>https://github.com/spring-projects/spring-boot</url> </scm> <issueManagement> <system>GitHub</system> <url>https://github.com/spring-projects/spring-boot/issues</url> </issueManagement> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>2.3.1.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> <version>2.3.1.RELEASE</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-json</artifactId> <version>2.3.1.RELEASE</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <version>2.3.1.RELEASE</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <scope>compile</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <scope>compile</scope> </dependency> </dependencies> </project>
沒有發(fā)現(xiàn) hibernate-validator
原版本如下:
<dependency> <groupId>org.hibernate.validator</groupId> <artifactId>hibernate-validator</artifactId> <version>6.0.17.Final</version> <scope>compile</scope> </dependency>
剛看了一下官方文檔。需要手動(dòng)引入
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-validation</artifactId> </dependency>
到此這篇關(guān)于springboot 2.3之后消失的hibernate-validator解決方法的文章就介紹到這了,更多相關(guān)springboot2.3 hibernate-validator內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- springboot2.3之后hibernate-validator依賴缺失【踩坑】
- SpringBoot 使用hibernate validator校驗(yàn)
- springboot使用hibernate validator校驗(yàn)方式
- SpringBoot實(shí)現(xiàn)全局異常處理方法總結(jié)
- SpringBoot配置GlobalExceptionHandler全局異常處理器案例
- Springboot之自定義全局異常處理的實(shí)現(xiàn)
- SpringBoot學(xué)習(xí)之全局異常處理設(shè)置(返回JSON)
- Springboot整合hibernate validator 全局異常處理步驟詳解
相關(guān)文章
MyBatis使用resultMap如何解決列名和屬性名不一致
這篇文章主要介紹了MyBatis使用resultMap如何解決列名和屬性名不一致的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-01-01SpringBoot FailureAnalyzer實(shí)例使用教程
FailureAnalyzer是一種在啟動(dòng)時(shí)攔截exception并將其轉(zhuǎn)換為human-readable消息的好方法,包含在故障分析中。SpringBoot為application context相關(guān)的exceptions,JSR-303驗(yàn)證等提供了這樣的分析器,實(shí)際上很容易創(chuàng)建自己的2022-12-12Hibernate初體驗(yàn)及簡(jiǎn)單錯(cuò)誤排除代碼詳解
這篇文章主要介紹了Hibernate初體驗(yàn)及簡(jiǎn)單錯(cuò)誤排除代碼詳解,分享了相關(guān)代碼示例,小編覺得還是挺不錯(cuò)的,具有一定借鑒價(jià)值,需要的朋友可以參考下2018-02-02Spring中的SpringData詳細(xì)說(shuō)明
這篇文章主要介紹了Spring中的SpringData詳細(xì)說(shuō)明,Spring Data 是Spring 的一個(gè)子項(xiàng)目, 旨在統(tǒng)一和簡(jiǎn)化對(duì)各類型持久化存儲(chǔ), 而不拘泥于是關(guān)系型數(shù)據(jù)庫(kù)還是NoSQL 數(shù)據(jù)存儲(chǔ),需要的朋友可以參考下2023-11-11Java中不用第三個(gè)變量來(lái)互換兩個(gè)變量的值
在程序運(yùn)行期間,隨時(shí)可能產(chǎn)生一些臨時(shí)數(shù)據(jù),應(yīng)用程序會(huì)將這些數(shù)據(jù)保存在一些內(nèi)存單元中,每個(gè)內(nèi)存單元都用一個(gè)標(biāo)識(shí)符來(lái)標(biāo)識(shí)。這些內(nèi)存單元被稱為變量,定義的標(biāo)識(shí)符就是變量名,內(nèi)存單元中存儲(chǔ)的數(shù)據(jù)就是變量的值2021-10-10