springaop需要一些,但不需要其他

lfapxunr  于 2021-07-13  发布在  Java
关注(0)|答案(0)|浏览(181)

edit:看起来像是的一个复制品,但它没有完全回答:pojogetter上的spring aop-setting-advice不被调用
这是一个控制器。我的建议是为控制器方法gettestperson()调用的,但不是为person.getanonymous()或getclassname()调用的。personcontroller和personpojo类在同一个包中。为什么会发生这种情况/我如何才能使之在person类的方法被调用时触发aop方法?

@RestController
public class PersonController {
    @GetMapping("/gettestperson")
    public Person getTestPerson() {
        Person person = new Person();
        person.getAnonymous();// simple public method
        person.getClassName();// simple public method
        return person;
    }
}
@Component
@Aspect
public class FalseBooleanAspect {
    @Before("execution(* com.example.project.person..*.get*())")
    public void demoGET7(final JoinPoint joinPoint) {
        System.out.println("7get*()joinpoint:" + joinPoint);
    }
}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题