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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:48:59+00:00 2026-06-16T07:48:59+00:00

I wish to implement dynamically changeable menu (updating whenever annotated method or controller added)

  • 0

I wish to implement dynamically changeable menu (updating whenever annotated method or controller added) for my Spring MVC application.

What i want is to introduce new annotation (@RequestMenuMapping) which will go to @Controller beans and their methods (just like @RequestMapping works).

Heres is what i want, User class, producing menu like

Users
    Index | List | Signup | Login

with following code:

@Controller
@RequestMapping("user")
@RequestMenuMapping("Users")
public class User {

    @RequestMapping("")
    @RequestMenuMapping("Index")
    public String index(/* no model here - just show almost static page (yet with JSP checks for authority)*/) {
        return "user/index.tile";
    }

    @RequestMapping("list")
    @RequestMenuMapping("List")
    public String list(Model model) {

        model.addAttribute("userList",/* get userlist from DAO/Service */);

        return "user/list.tile";
    }

    @RequestMapping("signup")
    @RequestMenuMapping("Signup")
    public String signup(Model model) {

        model.addAttribute("user",/* create new UserModel instance to be populated by user via html form */);

        return "user/signup.tile";
    }

    @RequestMapping("login")
    @RequestMenuMapping("Login")
    public String login(Model model) {

        model.addAttribute("userCreds",/* create new UserCreds instance to be populated via html form with login and pssword*/);

        return "user/login.tile";
    }
}

I think that Spring AOP may help me to pointcut methods with @RequestMenuMapping annotation and via @AfterReturning add something representing web-site menu to model.

But this raises two questions:

  1. How do i get Model instance in @AfterReturning advice method in case it is missing in adviced method (as in .index())?
  2. How do i get all methods (as in java reflection Method) and classes (as in java reflection Class) annotated with @RequestMenuMapping in order to build complete menu index?
  • 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-16T07:49:01+00:00Added an answer on June 16, 2026 at 7:49 am

    InterceptorDemo:

    @Aspect
    @Component
    public class InterceptorDemo {
    
      @Pointcut("@annotation(org.springframework.web.bind.annotation.RequestMapping)")
      public void requestMapping() {
      }
      @Pointcut("@annotation(you.package.RequestMenuMapping)")
      public void requestMenuMapping() {
      }
    
    
      @AfterReturning("requestMapping() && equestMenuMapping()")
      public void checkServer(JoinPoint joinPoint,Object returnObj) throws Throwable {
          Object[] args = joinPoint.getArgs();
          Model m = (Model)args[0];
          // use joinPoint get class or methd...
      }
    }
    

    If you want to intercept Contoller with you own, you can wirte another pointcut and ProceedingJoinPoint object can get what you want.

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

Sidebar

Related Questions

I wish to implement SQL Server Profiler in a C#/ VB.NET application. Is there a
I want to implement threading in c++.I am using visual stdio2008 and wish to
Hi i wish to implement push notification in my own android application. how can
My application contains an area filled with buttons. I wish to implement the activity
I wish to implement a fairly simple CSV checker in my C#/ASP.NET application -
I wish to implement a pint brush sort of application on my site using
I wish to implement multi-class SVM using one-vs-one method on fisheriris data in MATLAB.
I wish to implement the fmt.Stringer interface's String method. However for a set of
I wish to implement soft shadows produced by area lights in my raytracer. I'm
I'm working on a project in C++ where I'd wish to implement the ability

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.