Java 类org.springframework.boot.test.autoconfigure.web.servlet.MockMvcBuilderCustomizer 实例源码

项目:sagan    文件:IntegrationTestsConfig.java   
@Bean
public MockMvcBuilderCustomizer mockMvcBuilderCustomizer(ListableBeanFactory beanFactory) {
    Filter springSecurityFilterChain = beanFactory.getBean("springSecurityFilterChain", Filter.class);
    return builder -> builder.addFilters(springSecurityFilterChain)
            .defaultRequest(get("/").with(csrf()).with(user(123L).roles("ADMIN")))
            .build();

}