Java WebSecurity Configurer类Spring引导未按要求工作。。。项目中没有其他Web安全配置程序

Java WebSecurity Configurer类Spring引导未按要求工作。。。项目中没有其他Web安全配置程序,java,spring,spring-boot,model-view-controller,Java,Spring,Spring Boot,Model View Controller,点击/logout.jso会话时,在您的注销配置中,Cookie未被清除,请删除注销的“.jsp”,尝试以下操作: public void configure(HttpSecurity http) throws Exception { http.antMatcher("/**").authorizeRequests().anyRequest().hasRole("USER") .and().formLogin().loginPage("/login.jsp")

点击/logout.jso会话时,在您的注销配置中,Cookie未被清除,请删除注销的“.jsp”,尝试以下操作:

public void configure(HttpSecurity http) throws Exception {
    http.antMatcher("/**").authorizeRequests().anyRequest().hasRole("USER")
            .and().formLogin().loginPage("/login.jsp")
            .failureUrl("/login.jsp?error=1").loginProcessingUrl("/login")
            .permitAll().and().logout().logoutUrl("/logout.jsp").invalidateHttpSession(true).deleteCookies("JSESSIONID")
            .logoutSuccessUrl("/listEmployees.html");

}
在您的注销按钮中,只需添加:

logout.logoutRequestMatcher(new AntPathRequestMatcher("/logout")).invalidateHttp...

请让您的问题更清楚,并丰富您的内容。在使用WebSecurity的configurer方法ConfigurerAdapter时,仅完成身份验证。。未执行会话管理,即不会删除Cookie,也不会使会话无效。将此批注添加到安全类或进行登录的服务类中时:@Scope(value=“Session”,proxyMode=ScopedProxyMode.TARGET\u class)
href="/logout" (just it)