Spring boot 使用SpringBootDev的HttpSecurity

Spring boot 使用SpringBootDev的HttpSecurity,spring-boot,spring-boot-devtools,Spring Boot,Spring Boot Devtools,我正在使用远程应用程序中的SpringDev工具重新加载spring。 我有一个关于HttpSecurity配置的错误 如前所述,我将其放在confighttpsecurity中: http.requestMatchers("/.~~spring-boot!~/restart").anyRequest().anonymous() .and().csrf().disable(); FirstRequestMatchers在2.2.4.RELEASE版本中不存在,所以我用a

我正在使用远程应用程序中的SpringDev工具重新加载spring。 我有一个关于HttpSecurity配置的错误

如前所述,我将其放在config
http
security中:

http.requestMatchers("/.~~spring-boot!~/restart").anyRequest().anonymous()
            .and().csrf().disable();
FirstRequestMatchers在2.2.4.RELEASE版本中不存在,所以我用antMatcher替换了它。但是应用程序必须验证其他URL。我尝试了多种不同的配置,但从未奏效

首先 第三 你能帮我吗?一些conf的结果是例外:

线程“File Watcher”java.lang.IllegalStateException中的异常: 上载类文件时出现意外401未经授权的响应。其中包括: 无法在其自身之后配置任何请求


我很迷茫,因为我认为蚂蚁匹配器会起作用。有什么想法吗?

请求匹配者仍然存在。另外,这不是spring启动的问题,而是spring安全性的问题。我使用的是SpringSecurity 5.2.1。我不明白HttpSecurity是如何工作的。如果我把regexMatcher放在第一位(String),以便在放置anyRequets之前使用String,那么这个顺序可能会起作用,但不会起作用
http.csrf().disable().sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
        .antMatcher("/.~~spring-boot!~/restart").anonymous().and().
        authorizeRequests(aR -> aR
                .antMatchers("/.~~spring-boot!~/restart").anonymous()
                .anyRequest().authenticated()
                )
        .logout().disable()
        .addFilterBefore(new AuthTokenFilter(userRepository, env), UsernamePasswordAuthenticationFilter.class);
http.csrf().disable().sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
        .and()
        .antMatcher("/.~~spring-boot!~/**").authorizeRequests().anyRequest().anonymous()
        .and()
        .authorizeRequests().anyRequest().authenticated()
        .and()
        .logout().disable()
        .addFilterBefore(new AuthTokenFilter(userRepository, env), UsernamePasswordAuthenticationFilter.class);
http.csrf().disable().sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
                .antMatcher("/.~~spring-boot!~/restart").anonymous().and().authorizeRequests().anyRequest().authenticated().and().logout().disable()
                .addFilterBefore(new AuthTokenFilter(userRepository, env), UsernamePasswordAuthenticationFilter.class);