Spring Boot setup security for testing

后端 未结 2 1339
悲&欢浪女
悲&欢浪女 2020-12-16 03:45

I\'m unable to configure correctly the security in my tests. My web security configuration:

@Configuration
@EnableWebMvcSecurity
public class WebSecurityConf         


        
2条回答
  •  攒了一身酷
    2020-12-16 04:21

    Make the following modifications to your code:

       @Autowired
       private FilterChainProxy filterChainProxy;
    
    
        @Before
        public void setUp() {
            MockitoAnnotations.initMocks(this);
            this.mockMvc = webAppContextSetup(wac).dispatchOptions(true).addFilters(filterChainProxy).build();
        }
    

提交回复
热议问题