0

I have question about controllers. Always when i working with controller im start to declare @RequestMapping for example if have UserController then is @RequestMapping("/user");

What if i want to declare another path in this same controller? For example im have @GetMapping("/info") and i will get info about user, but what if i want to declare on this same controller path localhost:8080/topic/blablabla? Is another solution than delete @RequestMapping from controller and make on every Get/PostMapping another path?

1 Answer 1

1

Defining a @RequestMapping at the controller level; it means narrowing it down to your criteria.

You can use the @RequestMapping annotation to map requests to controllers methods. It has various attributes to match by URL, HTTP method, request parameters, headers, and media types. You can use it at the class level to express shared mappings or at the method level to narrow down to a specific endpoint mapping. Read More

It is good you want to do, sometimes I need it too but as far as I research it is not supported now.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.