Java 如何修复弹簧靴的底座?

Java 如何修复弹簧靴的底座?,java,spring-boot,spring-security,Java,Spring Boot,Spring Security,我正在写一个SpringBoot应用程序。当我向邮递员发出请求时,我经常会遇到以下错误: java.lang.NullPointerException: null at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.authenticationIsRequired(BasicAuthenticationFilter.java:222) ~[spring-security-web-

我正在写一个SpringBoot应用程序。当我向邮递员发出请求时,我经常会遇到以下错误:

java.lang.NullPointerException: null
    at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.authenticationIsRequired(BasicAuthenticationFilter.java:222) ~[spring-security-web-5.2.1.RELEASE.jar:5.2.1.RELEASE]
    at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:166) ~[spring-security-web-5.2.1.RELEASE.jar:5.2.1.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
这是我的安全配置:

@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    @Autowired
    private UserService userService;

    @Autowired
    private PasswordEncoder passwordEncoder;

    @Bean
    public PasswordEncoder getPasswordEncoder() {
        return new BCryptPasswordEncoder(8);
    }

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
                .authorizeRequests()
                .antMatchers("/", "/registration", "/restaurants").permitAll()
                .anyRequest().authenticated()
                .and()
                .httpBasic()
                .and()
                .rememberMe()
                .and()
                .logout()
                .permitAll();

        //Set enable when frontend added
        http.csrf().disable();
    }

    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth.userDetailsService(userService)
                .passwordEncoder(passwordEncoder);
    }
}

如何修复它?我需要向邮差发出请求,因此我无法更改登录表单。

转到邮差窗口中的
授权
选项卡(在请求类型下),选择“基本身份验证”,如果您正在执行“/”、“/registration”和“/restaurants”以外的任何请求,请填写您的凭据.

Postman在我添加授权参数后,在50%的请求中给了我该错误。请确保您在每个请求中从上面设置了
Authorization
设置。我确定。我的同事也有同样的问题