Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange Behaviour when using Before and Around Advice together [SPR-12568] #17169

spring-issuemaster opened this issue Dec 24, 2014 · 2 comments


Copy link

@spring-issuemaster spring-issuemaster commented Dec 24, 2014

vijay jumbad opened SPR-12568 and commented

I created Configuration based AnnotationConfigApplicationContext .
AnnotationConfigApplicationContext appContext = new AnnotationConfigApplicationContext(

Using Aspectj annotation I tried to use Before ,After and Around advice for a particular Spring bean.

@Before(value = "execution (* com.vijay.AOPExample.codingArtifacts.Service.(..))")
public void authenticate() throws Throwable {

	System.out.println("Calling Authentication Mechanism...");
	System.out.println("Authentication Successful...");

@After(value = "execution (* com.vijay.AOPExample.codingArtifacts.*Service.*(..))")
public void audit() {
	System.out.println("Doing Audit...");
	System.out.println("Audit Completed....");

@Around(value = "execution (* com.vijay.AOPExample.codingArtifacts.*Service.*(..))")
public void performTest() {
	System.out.println(" System time is " + System.nanoTime());

The above annotations were expected to be applied to spring CalculationService bean. But instead of executing the bean method and applying the advices it only applied After advice and part of Around advice and no service method functionality was executed.

Source code is attached for the reference.

Affects: 4.1.3



This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented May 30, 2015

Srideep Prasad commented

This is not a bug from what I can see.
Just change your @Around advice as follows:

@Around(value = "execution (* com.vijay.AOPExample.codingArtifacts.Service.(..))")
public void performTest(ProceedingJoinPoint proceedingJoinPoint) throws Throwable { proceedingJoinPoint.proceed()

And it should work just fine!


This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jun 1, 2015

Stéphane Nicoll commented

Indeed, your Around advice should actually invoke the underlying method for the other advices to apply properly.

vijayVJ please post such user questions on StackOverflow. Thanks Srideep Prasad!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.