The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

RobertGloverJr (30) [Avatar] Offline
#1
I like this chapter (AOP Chapter 4). It makes a dry subject interesting.
However I have an issue with Figure 4.5

In its current form, figure 4.5 demonstrates a tautology.

It says to only search within package "com.springinaction.springidol" for the fully qualified class name and method name "com.springinaction.springidol.Intrument.play(..)".

But it is impossible for that Instrument class name and method name (because it is fully qualified with the package name ) to ever NOT be in package "com.springinaction.springidol".

I think what Craig meant to do in figure 4.5 was something similar to the following. My syntax is probably not perfect, so think of this as pseudo code:

execution(* +Instrument.play(...) && within (com.springinaction.springidol.*)

I have one other suggestion for AOP Chapter 4. Every pointcut example in the entire chapter selects a specific method name. There is not one example in the entire chapter whose pointcut selects more than more method name.

I would like Craig to add an example that uses a pointcut that is more generic. For example, Craig might show how easy it would be to add logging so that every method in package com.springinaction.springidol that has a method name that begins with "set" would write a message to System.out that shows the "toString" form of it's single input parameter. This would also provide Craig with an opportunity to show how a pointcut could be configured to only select methods (in this example, methods with a name that begins with "set") which have exactly one input parameter.