Spring boot LemonWebSecurity配置定制

Spring boot LemonWebSecurity配置定制,spring-boot,spring-lemon,Spring Boot,Spring Lemon,我用SpringLemon做我的项目。我想定制authorizeRequests方法,以便只有经过身份验证的用户才能访问以/xyz开头的任何请求/xyz/abc、/xyz/def、xyz/ghi/jkl等。 为了做到这一点,我创建了自己的类来扩展LemonWebSecurityConfig类,并将其设置为配置类。我已重写authorizeRequests方法,使其如下所示: @Override protected void authorizeRequests(HttpSecurity h

我用SpringLemon做我的项目。我想定制authorizeRequests方法,以便只有经过身份验证的用户才能访问以/xyz开头的任何请求/xyz/abc、/xyz/def、xyz/ghi/jkl等。 为了做到这一点,我创建了自己的类来扩展LemonWebSecurityConfig类,并将其设置为配置类。我已重写authorizeRequests方法,使其如下所示:

@Override
    protected void authorizeRequests(HttpSecurity http) throws Exception {
        http.authorizeRequests()
            .mvcMatchers("/xyz/**").authenticated()
            .mvcMatchers("/**").permitAll();                  
    }
当我测试它时,它对那些/xyz URL有效,在没有身份验证的情况下得到403,/api/core/context给了我200,但是/api/core/login URL总是给了我404。即使我没有重写authorizeRequests方法,并且我只有空的配置类,它也会用404响应。
我错过了什么

实际上我扩展了一个错误的类。使用lemon demo jpa中所示的正确类,它可以完美地工作:

@Component
public class MySecurityConfig extends LemonJpaSecurityConfig {

    @Override
    protected void authorizeRequests(HttpSecurity http) throws Exception {
        http.authorizeRequests()
            .mvcMatchers("/xyz/**").authenticated();
        super.authorizeRequests(http);
    }
}