java - 当我运行我的 Spring Boot 应用程序时,我收到以下错误。我正在使用 Spring Boot 版本 2.3.1
问题描述
Spring Boot 应用程序错误!当我运行我的 Spring Boot 应用程序时,我收到以下错误。我正在使用 Spring Boot 版本 2.3.1
java.lang.IllegalArgumentException: Could not find class [org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration]
at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:334) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.core.annotation.TypeMappedAnnotation.adapt(TypeMappedAnnotation.java:446) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.core.annotation.TypeMappedAnnotation.getValue(TypeMappedAnnotation.java:369) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.core.annotation.TypeMappedAnnotation.asMap(TypeMappedAnnotation.java:284)
下面给出了我的 pom.xml 文件我尝试添加依赖项,但它不起作用
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.mani.restws</groupId>
<artifactId>restws</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>restws</name>
<description>Patient REST Services</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
<version>3.1.11</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<!-- <version>2.3.1.RELEASE</version> -->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
解决方案
就我而言,这种依赖关系的问题:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
<version>3.1.11</version>
</dependency>
您可以为此更改版本并添加 hibernate-validator
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
<version>3.3.6</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.1.5.Final</version>
</dependency>
推荐阅读
- mysql - 如何使用 MySQL 设计动态表
- windows - Powershell 是否存在语言中立的文件系统对象动词?
- python - 在python中验证http响应
- elasticsearch - 使用 CloudID、用户名和密码连接到 Elasticsearch
- sql-server - 将多个具有关系的 EXCEL 文件(Vlookup)导入 MS SQL Server
- android - 如何阻止相同的广播(来自 PendingIntent)排队?
- amazon-web-services - amazon s3 预签名的 url 应该使用新的访问密钥辞职
- javascript - 将数组传递给 JavaScript 显示为 Object
- java - jhipster为什么不更新
- html - 使用 css 反映 svg