Apress/pro-spring-5

Chapter5 - NamePointcutUsingAdvisor

rafalnowicki116 opened this issue · 2 comments

Hey,

Inside the code (chapter05==>simple-name-matching), you have overriding:

NameMatchMethodPointcutAdvisor advisor = new NameMatchMethodPointcutAdvisor(new SimpleAdvice());
advisor.setMappedNames("sing");
advisor.setMappedNames("rest"); ==> replace all methods above

BTW, In the book (Pro Spring 5 - Fifth Edition), the code is a little bit different than in repo and doesn't work with the intention (maybe errata was created hard to say).

BR,
Rafał

Hello @rafalnowicki116,

Haven't looked at this code for a while. I will take a look at it as soon as I can, and make the adjustements to fit context of the book.

Thank you so much for your contribution!

Hello @rafalnowicki116,

The example you are pointing to, was not meant to have the same behaviour as the one in the previous section. It just demostrates how NameMatchMethodPointcutAdvisor works, including the fact that calling advisor.setMappedNames("rest") overrides the list of methods to intercept.

I don't see how the code in the book differs from the one in the book. Except for missing the import statements, the code in the Convenience Advisor Implementations is the same as the one in the NamePointcutUsingAdvisor class.

I consider this issue resolved.

Cheers,
Iuliana Cosmina