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

  • Home
  • SEARCH
  • 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 6710895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:04:33+00:00 2026-05-26T08:04:33+00:00

I wanted to specify a pattern for aspectj @Around aspect that includes multiple packages.

  • 0

I wanted to specify a pattern for aspectj @Around aspect that includes multiple packages.

Example : package 1 : aaa.bbb.ccc.ddd
          package 2 : aaa.bbb.ccc.eee 
          package 3 : aaa.bbb.ccc.eee.fff

Pattern which i used :

@Around("execution(* aaa.bbb.ccc.ddd.*.*(..)) && execution(* aaa.bbb.ccc.eee..*.*(..))")
    i.e Intercept packages aaa.bbb.ccc.ddd, aaa.bbb.ccc.eee and any sub-package of aaa.bbb.ccc.eee

But this pattern doesnt seem to work. Though specifying a single pattern without && condition works.

Can someone suggest whats wrong with this pattern?

Thanks,
Gayathri

  • 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-05-26T08:04:33+00:00Added an answer on May 26, 2026 at 8:04 am

    && stands for logical AND. What You need here is a logical OR, that in AspectJ is ||.

    @Pointcut("execution(* aaa.bbb.ccc.ddd.*.*(..))")
    public void methodInDddPackage() {}
    
    @Pointcut("execution(* aaa.bbb.ccc.eee.*.*(..))")
    public void methodInEeePackage() {}
    
    @Pointcut("methodInDddPackage() || methodInEeePackage()")
    public void methodInDddOrEeePackage() {}
    

    Below equivalent inline expression:

    @Pointcut("execution(* aaa.bbb.ccc.ddd.*.*(..)) || execution(* aaa.bbb.ccc.eee.*.*(..))")
    public void methodInDddOrEeePackageInline() {}
    

    See this Spring AOP documentation page for more details.

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

Sidebar

Related Questions

I'm creating a game desk. I wanted to specify field size (one field is
Wanted to get some consensus around a UI feature I'm working on right now.
I wanted some of those spiffy rounded corners for a web project that I'm
I wanted to write a small script that searched for an exact file name,
A colleague of mine has a remote git repo that I wanted to clone
Similar to this Java question . I would like to specify that a variable
Does anyone know the proper syntax on how to specify the model that you
In WCF land, you can specify a Namespace prefix for anything that has a
I am currently playing around with the FileSystemWatcher class wanted to know how to
I recently decided that I wanted all people who commit to my repository to

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.