Can Java Annotations help me with this?

前端 未结 7 659
日久生厌
日久生厌 2021-01-13 14:52

I\'m wondering if there is a way to specify that a method gets called in advance of a class method. I know something like this should be posssible, since JUnit has before(),

7条回答
  •  半阙折子戏
    2021-01-13 15:28

    AOP does this with what are known as pointcuts AspectJ might have what you need.

    Simplistically speaking, you would add before advice to your foo() method which would call init()

提交回复
热议问题