Issue
after building spring app, I have this problem:
.../WebSecurityConfigurerAdapter.class] cannot be opened because it does not exist at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:181)
<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>
SecurityConfig class:
@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");
}
}
Inizializer:
public class SecurityWebApplicationInitializer extends AbstractSecurityWebApplicationInitializer {
}
It seems that it can't find jar file after build. I tried adding it to artifacts in Project Structure in IntelliJ Idea, but it didn't help.
Solution
Go to Project Structure -> Artifacts -> Click green '+' button -> and all Spring Security libaries
Answered By - Raspberry
Answer Checked By - Marie Seifert (JavaFixing Admin)