java.io.FileNotFoundException: class path resource [org/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class] cannot be opened because it does not exist
时间: 2023-06-13 13:02:21 浏览: 319
这个错误提示是因为你的项目缺少了 Spring Security 的相关依赖。
你需要在项目的 pom.xml 文件中添加以下依赖:
```
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>5.3.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>5.3.4.RELEASE</version>
</dependency>
```
如果你使用的是 Gradle,可以在 build.gradle 文件中添加以下依赖:
```
implementation 'org.springframework.security:spring-security-config:5.3.4.RELEASE'
implementation 'org.springframework.security:spring-security-web:5.3.4.RELEASE'
```
添加完依赖之后,重新构建项目,该错误就会被解决。
相关问题
Caused by: java.io.FileNotFoundException: class path resource [org/springframework/web/servlet/config/annotation/WebMvcConfigurer.class] cannot be opened because it does not exist
这个错误通常表示在你的项目中缺少了 `spring-webmvc` 依赖。`WebMvcConfigurer` 是 Spring Framework 中用于配置 WebMvc 的接口,如果缺少这个类,可能是因为没有添加正确的依赖。
要解决这个问题,你可以尝试以下几个步骤:
1. 确保在你的项目的构建文件(如 Maven 的 `pom.xml` 或 Gradle 的 `build.gradle`)中添加了正确的依赖。对于 Spring MVC,你需要添加 `spring-webmvc` 依赖。示例 Maven 依赖配置如下:
```xml
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>版本号</version>
</dependency>
```
2. 如果已经添加了正确的依赖,尝试清理和重新构建你的项目,以确保依赖正确地被下载和引入。
3. 如果你使用的是 IDE,可以尝试刷新你的项目依赖或重启 IDE,以确保它正确地加载了依赖。
如果以上步骤都没有解决问题,可以提供更多关于你项目的信息,例如你正在使用的框架、构建工具和相关配置,我们可以进一步帮助你解决问题。
Caused by: java.io.FileNotFoundException: class path resource [org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.class] cannot be opened because it does not exist
这个错误是由于找不到指定的类路径资源而引起的。具体来说,错误信息中提到的类路径资源\[org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.class\]无法打开,因为它不存在。这可能是由于您使用的Spring Boot版本与Hystrix版本不兼容所致。根据引用\[2\]中提供的信息,您正在使用的Spring Boot版本是2.3.0.RELEASE。要解决这个问题,您可以尝试更新您的Spring Boot版本,或者检查您的依赖关系,确保您使用的Hystrix版本与您的Spring Boot版本兼容。
#### 引用[.reference_title]
- *1* *3* [Caused by: java.io.FileNotFoundException: class path resource](https://blog.csdn.net/weixin_39732991/article/details/114613779)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.class](https://blog.csdn.net/huangxy6688/article/details/108275521)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文
相关推荐
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231044955.png)
![-](https://img-home.csdnimg.cn/images/20241231045021.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)