gpt4 book ai didi

java - WebSecurityConfigurerAdapter.class] 无法打开,因为它不存在

转载 作者:太空宇宙 更新时间:2023-11-04 10:49:07 30 4
gpt4 key购买 nike

构建 Spring 应用程序后,我遇到了这个问题:

  .../WebSecurityConfigurerAdapter.class] cannot be opened because it does not exist at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:181)

我的pom.xml

<properties>
<spring.version>4.3.0.RELEASE</spring.version>
<springsecurity.version>4.2.3.RELEASE</springsecurity.version>
<!--<springsecurity.version>5.0.0.RELEASE</springsecurity.version>-->
</properties>


<dependencies>


<!--spring security web and config-->

<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${springsecurity.version}</version>
</dependency>

<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${springsecurity.version}</version>
</dependency>

<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>${springsecurity.version}</version>
</dependency>

安全配置类:

    @Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("john").password("secret123").roles("EMPLOYEE");
auth.inMemoryAuthentication().withUser("mary").password("secret123").roles("MANAGER");
auth.inMemoryAuthentication().withUser("susan").password("secret123").roles("ADMIN");

}

}

初始化器:

public class SecurityWebApplicationInitializer extends AbstractSecurityWebApplicationInitializer {

}

构建后似乎找不到jar文件。我尝试将其添加到 IntelliJ Idea 中的项目结构中的工件中,但没有帮助。

最佳答案

How to add artifact

转到项目结构 -> 工件 -> 单击绿色“+”按钮 -> 和所有 Spring Security 库

关于java - WebSecurityConfigurerAdapter.class] 无法打开,因为它不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48037446/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com