Итак, мой класс конфигурации выглядит так: < /p>
Код: Выделить всё
@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("spring_user")
.password("password123")
.roles("ADMIN");
}
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.authorizeHttpRequests((authz) -> authz.anyRequest().authenticated())
.httpBasic(Customizer.withDefaults());
return http.build();
}
@Bean
public static PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
}
< /code>
pom.xml файл: < /p>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
org.springframework.boot
spring-boot-starter-parent
3.0.1
com.codelib
basic-auth-security
0.0.1-SNAPSHOT
basic-auth-security
basic-auth-security
17
org.springframework.boot
spring-boot-starter-security
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-devtools
runtime
true
org.springframework.boot
spring-boot-starter-test
test
org.springframework.security
spring-security-test
test
org.springframework.security
spring-security-config
5.7.3
org.springframework.boot
spring-boot-maven-plugin
В остальной части проекта нет ничего интересного. Когда я пытаюсь запустить приложение, отображается следующее сообщение: < /p>
java: cannot access javax.servlet.Filter
class file for javax.servlet.Filter not found
< /code>
и идея перенаправляет меня в файл конфигурации. (Но никакие строки кода подчеркнуты красным)
Что может быть причиной этого?
Подробнее здесь: https://stackoverflow.com/questions/749 ... let-filter