Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8770519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:34:19+00:00 2026-06-13T17:34:19+00:00

Have a RESTful web-serice with Facade layer, Service layer and Dao layer. Trying to

  • 0

Have a RESTful web-serice with Facade layer, Service layer and Dao layer.
Trying to journalize all invokes of all methods of classes, marked with annotation @Log

@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Log {
}

Here’s the aspect code:

public class LoggingAspect {
  @Around("@target(Log)")
  public Object log(ProceedingJoinPoint pjp) throws Throwable {
    log.debug("Start " + pjp.getSignature().getName());
    Object result = pjp.proceed();
    log.debug("End " + pjp.getSignature().getName());
    return result;
  }
}

Facade, Service and Dao are marked with @Log.
Some example:

public Obj Facade.createObj(String name){ //1
  return service.createObj(name);
}

public Obj Service.createObj(String name){ //2
  return dao.createObj(name);
}

public Obj Dao.createObj(String name){ //3
  Long idOfCreatedObj = /*code that creates an object and returns it's ID*/;
  return loadObjById(idOfCreatedObj); /* load the created object by id */
}

public Obj Dao.loadObjById(Long id){ //4
  return /* code that loads the object by it's id */;
}

In this example methods 1, 2, 3 are logged successfully. But the nested dao method (loadObjById) is not logged.

WHY?

P.S. In spring-config.xml there’s
<aop:aspectj-autoproxy proxy-target-class="true"/>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:34:20+00:00Added an answer on June 13, 2026 at 5:34 pm

    The issue is self calls (this.methodcall()) bypass the dynamic/cglib proxy that is created by Spring to handle the cross cutting concern.

    The fix is either to use full Aspectj (compile time or load time weaving) or make the call by getting hold of the proxy (instead of alling this.methodCall(), use proxy.methodCall()

    You can get hold of the proxy this way:

    <aop:aspectj-autoproxy expose-proxy="true"/>
    

    And in your code: AopContext.currentProxy() will give you a reference to the proxy. Here is one blog article on this if you are interested – http://www.java-allandsundry.com/2012/07/reference-to-dynamic-proxy-in-proxied.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Silverlight application. I'm trying to make calls to RESTful web service.
I have a restful web service located on a local tomcat instance. I'm trying
I'm trying to consume a RESTful web service using WCF. I have no control
I have been trying to find a way to implement a RESTful web service
I have a RESTful web service which runs on Glassfish Application Server. When I
I have a restful web service which can deal with DTOs in json format
I have a ReSTful web service which needs to parse locale-sensitive data from the
I have created a RESTful PHP web service using Lithium which contains comments, each
I have a web service site that is restful enabled, so other websites/ajax script
I have a DESKTOP application which interacts with a web service through their RESTful

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.