An optional @PathVariable argument on @ModelAttribute methods makes sense. The challenge is that on @RequestMapping methods it doesn't make sense so I don't think an annotation attribute is a choice here. It would help one case but cause confusion for the most common case.
Note that today @PathVariable can be used with Map<String, String> which gives you all path variables. It's less convenient since you have to parse Strings but it's one way.
We can consider some way to allow optional @PathVariable argument on @ModelAttribute methods as long as it is explicit. For example the combination @PathVariable with java.util.Optional from JDK 1.8 on @ModelAttribute methods.
Good to know it can has a solution, but I don't understand your explanation, in your convenience, would you share a simple snippet code (how a draft in a new comment) to understand your idea and see if it resolves my "Addition" and "Second Addition" sections of my shared link?
Thank you, I have checked the Spring Framework Reference Documentation and there is no an example about @PathVariable working together with Map<String, String> I have no checked the same for @RequestHeader, @RequestParam too