Languages
[Edit]
EN

Spring Boot 2 - request mapping with wildcard parameter (/path/**)

6 points
Created by:
Alicia-Lambert
580

In this short article, we would like to show how to get wildcard request parameters (under stars parameter from /some/path/**) from URL in Spring Boot 2.

Quick solution:

     

    Reusable @WildcardParam annotation

    Edit

    This section contains an example source code, how to create and use simple @WildcardParam annotation.

    Simple steps:

    1. create wildcard annotation to simplify controller mappings usage,
    2. register wildcard annotation in application configuration,
    3. use wildcard parameters in @PathVariable way.

    ExampleController.java file:

    WildcardParam.java file:

    MVCConfig.java file:

    See also

    Edit
    1. Spring Boot 2 - request mapping with not decoded PathVariable (/path/{pathVariable})

    Alternative titles

    1. Spring Boot 2 - request mapping wildcard exceptions (/path/**)
    2. Spring Boot 2 - request mapping with wildcard variable (/path/**)
    1
    Donate to Dirask
    Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
    Join to our subscribers to be up to date with content, news and offers.
    Native Advertising
    🚀
    Get your tech brand or product in front of software developers.
    For more information Contact us
    Dirask - we help you to
    solve coding problems.
    Ask question.

    ❤️💻 🙂

    Join