Before Advice example

Let's see the use of @Before annotation:

    //Before transfer service 
    @Before("execution(* com.packt.patterninspring.chapter6.
bankapp.service.TransferService.transfer(..))") public void validate(){ System.out.println("bank validate your credentials before amount
transferring"); } //Before transfer service @Before("execution(* com.packt.patterninspring.chapter6.
bankapp.service.TransferService.transfer(..))") public void transferInstantiate(){ System.out.println("bank instantiate your amount transferring"); }
Note--if the advice throws an exception, target will not be called--this is a valid use of a Before Advice.

Now you have seen the before advice, let's have a look into another type advice.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset