提问如何在SpringBootTest中排除AOP的bean?

我有一个基础的测试,只测试controller的方法(主要是测试validation)。之前都是测试过了,但是我自己加了一个
“`

@Aspect
@Component
@Order(3)
public class PermissionAspect {
“`
在正常的使用中,没问题。但是在测试中,我其实不需要走这个逻辑,想把这个aop的bean给排除。有谁给指导一下么?
目前的测试类定义为
@SpringBootTest(properties = "spring.main.allow-bean-definition-overriding=true", webEnvironment = SpringBootTest.WebEnvironment.NONE)
@Import(UserControllerTestConfig.class)
class UserControllerTest {

UserControllerTestConfig主要定义了几个我需要用到的fake实现。

请登录后发表评论

      • chaosmo的头像-SpringForAll社区chaosmo作者0