Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
spring引导安全登录重定向到/当contextPath设置时_Spring_Spring Security_Spring Boot - Fatal编程技术网

spring引导安全登录重定向到/当contextPath设置时

spring引导安全登录重定向到/当contextPath设置时,spring,spring-security,spring-boot,Spring,Spring Security,Spring Boot,在没有设置contextPath的情况下,我可以让它工作。但是,当我在application.properties中设置server.contextPath时,在登录页面时会发生重定向到的情况。可能发生什么事,请帮忙 private static final String[] UNSECURED_RESOURCE_LIST = new String[]{"/", "/resources/**", "/static/**", "/css/**", "/webjars/**",

在没有设置contextPath的情况下,我可以让它工作。但是,当我在application.properties中设置server.contextPath时,在登录页面时会发生重定向到的情况。可能发生什么事,请帮忙

private static final String[] UNSECURED_RESOURCE_LIST =
        new String[]{"/", "/resources/**", "/static/**", "/css/**", "/webjars/**",
                "/img/**", "/js/**"};

@Override
protected void configure(HttpSecurity http) throws Exception {

    http.authorizeRequests()
            .antMatchers(UNSECURED_RESOURCE_LIST).permitAll()
            .anyRequest().authenticated()
            .and()
            .formLogin()
            .loginPage("/login")
            .defaultSuccessUrl("/index")
            .failureUrl("/login?error")
            .usernameParameter("email")
            .permitAll()
            .and()
            .logout()
            .logoutUrl("/logout")
            .deleteCookies("remember-me")
            .logoutSuccessUrl("/login")
            .permitAll()
            .and()
            .rememberMe();
}

@Override
public void configure(WebSecurity security) {
    //security.ignoring().antMatchers("/css/**","/img/**","/js/**");
    //security.ignoring().antMatchers("/static/**");
    security.ignoring().antMatchers(UNSECURED_RESOURCE_LIST);
    //security.ignoring().antMatchers("/resources/**");
}