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 8404461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:36:24+00:00 2026-06-09T22:36:24+00:00

I have declared the following Aspect which advices a dao call, I’m trying to

  • 0

I have declared the following Aspect which advices a dao call, I’m trying to run @Before advice but its not working.

Here goes the aspect.

package com.hedgebenefits.aop;

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
@Aspect
public class AccessControlAspect {
    @Before("within(com.hedgebenefits.daos..*) && execution(public * *(..))")
    public void daoCall() {
        System.out.println("Before advice invoked for DAO method called ");
    }
}

My application-context.xml has the following tag

<aop:aspectj-autoproxy/>

My Dao class is as follows:

package com.hedgebenefits.daos.impl;

import com.hedgebenefits.daos.AdminDao;
import com.hedgebenefits.domain.Admin;
import org.springframework.stereotype.Repository;

@Repository
public class AdminDaoImpl implements AdminDao{
    @Override
    public void save(Admin admin) {
    }
}

I put a breakpoint but I can see that its not active, I’m definitely doing some silly mistake here but can’t figure out. Pl. advice.

  • 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-09T22:36:25+00:00Added an answer on June 9, 2026 at 10:36 pm

    Your aspect needs to be a part of your application context.

    1. If you are using component-scan, either add @Component to your AccessControllerAspect, or setup the component-scan filters to include @Aspect annotations. To setup the filters, take a look at section 3.10.3 of the Spring documentation (Using filters to customize scanning).
    2. If you are using xml configuration, add a bean for AccessControllerAspect.

    The act of adding aop:aspectj-autoproxy is not enough. This tells beans that are already a part of your application context how to do the aspecting, it does not automatically include them.

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

Sidebar

Related Questions

I have declared the following enum type in which I want the first member
I have declared a manager to the following model, but after doing so, I
I am trying to run PhotoStream sample from following link http://android-developers.blogspot.com/2008/09/android-photostream.html But when i
say I do the following... //MyRunnable is a class that I have declared, which
I have declared the following type KEY = (IPv4, Integer) type TPSQ = TVar
I have declared the following struct: typedef struct _RECOGNITIONRESULT { int begin_time_ms, end_time_ms; char*
In following program . I have one doubt. I have declared one global variable
I have the declared a class in following way class A: def __init__(self, list_1,
I have the following template method declared in my interface: class IObjectFactory { public:
I have a project that requires the following. Four arrays will be declared in

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.