Disable security for unit tests with spring boot

前端 未结 8 1953
情话喂你
情话喂你 2020-11-27 19:16

I\'m trying to create a simple spring boot web project with security. I can launch the application fine and the security is working fine. However, I have some components t

8条回答
  •  独厮守ぢ
    2020-11-27 19:47

    In my case, @AutoConfigureMockMvc(addFilters = false) helped me.

    Example:

    @WebMvcTest(MyController.class)
    @AutoConfigureMockMvc(addFilters = false)
    @TestPropertySource(locations="classpath:application-test.properties")
    public class MyControllerTests {
    

    Cheers

提交回复
热议问题