是否存在与此XML配置等效的编程:
<logout logout-url="/logout"/>
虽然我可以像这样设置登录页面网址:
@Configuration
public static class ApplicationSecurity extends WebSecurityConfigurerAdapter {
@Override
public void configure(HttpSecurity http) throws Exception {
http
...
.formLogin()
.loginPage("/login");
}
我找不到logout-url的等价物。
答案 0 :(得分:2)
您需要and()
。
@Configuration
public static class ApplicationSecurity extends WebSecurityConfigurerAdapter {
@Override
public void configure(HttpSecurity http) throws Exception {
http
...
.formLogin()
.loginPage("/login")
.and()
.logout().logoutUrl("/logout");
}