java.lang.IllegalArgumentException: A ServletContext is required to configure default servlet handling

前端 未结 4 2070
遥遥无期
遥遥无期 2020-12-01 04:22

I have the following test class:

@ActiveProfiles({ \"DataTC\", \"test\" })
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {BaseTestC         


        
4条回答
  •  失恋的感觉
    2020-12-01 04:41

    I was getting a similar error but whilst running the application normally rather than trying to run tests.

    It turns out if you're making use of a custom PermissionEvaluator then you need to declare it in a separate @Configuration class to the one with your main Spring security configuration in.

    See: How do I add method based security to a Spring Boot project?

    There is also an open Github issue: https://github.com/spring-projects/spring-boot/issues/4875

提交回复
热议问题