Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Accessing the target from within @Around

Suppose I've got the following simple wrapper around a Job's run() method:

@Aspect
public class JobWrapperAspect {
	@Around("execution(void com.example.jobs.FooJob.run())")
	public void retryJob(ProceedingJoinPoint join_point) throws Throwable {
		System.out.println("About to run a FooJob");
		join_point.proceed();
		System.out.println("Done running a FooJob");
	}
}

That's pretty straightforward, and works well.

But is there any way to access the job object from within my advice?
Something like...

System.out.println("About to run a " + job.toString());
join_point.proceed();
System.out.println("Done running a " + job.toString());

Any ideas? How do I access the "job" object?

Thanks!

Norman


Back to the top