Java .and()在像HttpSecurity这样的spring安全类中做什么?有人帮我理解这一点

Java .and()在像HttpSecurity这样的spring安全类中做什么?有人帮我理解这一点,java,spring-security,Java,Spring Security,从春天开始: 表示与关闭XML标记相当的Java配置 使用and()方法,该方法允许我们继续配置 家长。如果你读了代码,它也是有意义的。我想配置 授权请求和配置表单登录和配置HTTP Basic 认证 P> >对于具有强> >管理员角色的用户,您有多个配置,第二个用于简单用户< /St>角色,将它们全部连接在一起,我们使用和() >方法> 这个技巧是一个你看过文档了吗?非常感谢。我用了15年的Java开发,在官方文档中甚至找不到“and”方法。@Chuck check事实上这个方法存在于许多

从春天开始:

表示与关闭XML标记相当的Java配置 使用and()方法,该方法允许我们继续配置 家长。如果你读了代码,它也是有意义的。我想配置 授权请求和配置表单登录和配置HTTP Basic 认证

<> P> >对于具有强> >管理员<强>角色的用户,您有多个配置,第二个用于<强>简单用户< /St>角色,将它们全部连接在一起,我们使用<代码>和() >方法>


这个技巧是一个

你看过文档了吗?非常感谢。我用了15年的Java开发,在官方文档中甚至找不到“and”方法。@Chuck check事实上这个方法存在于许多类中,其中一个是我共享的
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
            .addFilterAfter(new CsrfCookieGeneratorFilter(), CsrfFilter.class)
            .exceptionHandling()
            .authenticationEntryPoint(authenticationEntryPoint)
        .and()
            .rememberMe()
            .rememberMeServices(rememberMeServices)
            .key(env.getProperty("jhipster.security.rememberme.key"))
        .and()
            .formLogin()
            .loginProcessingUrl("/api/authentication")
            .successHandler(ajaxAuthenticationSuccessHandler)
            .failureHandler(ajaxAuthenticationFailureHandler)
            .usernameParameter("j_username")
            .passwordParameter("j_password")
            .permitAll()
        .and()
            .logout()
            .logoutUrl("/api/logout")
            .logoutSuccessHandler(ajaxLogoutSuccessHandler)
            .deleteCookies("JSESSIONID")
            .permitAll()
        .and()
            .headers()
            .frameOptions()
            .disable()
            .authorizeRequests()
                .antMatchers("/api/register").permitAll()
                .antMatchers("/api/activate").permitAll()
                .antMatchers("/api/authenticate").permitAll()
                .antMatchers("/api/logs/**").hasAuthority(AuthoritiesConstants.ADMIN)
                .antMatchers("/api/subscriptions").permitAll()
                .antMatchers("/api/**").authenticated();
}