简体   繁体   中英

Spring boot Request Mapping URI Patterns

There is a request mapping like this:

@DeleteMapping(value = "/{version:.+}")

I not sure what is the .+ does, but from what i know, this delete mapping can accept a value and match to path variable version , something like:

DELETE
/abc

Value abc will map to path variable version

Why the .+ is needed?


Edited Question: What is the difference with just /{version} , is there any special case that requires .+ ?

You can find details or URL matching on this link
URL matching

REGEX: .+ means one or more.
'*' Matches 0 or More Characters
'+' Matches 1 or More.

@DeleteMapping(value = "/{version:.+}")

.+ means "one or more of any characters" - thats standard regex/

version: means - put that match in path variable named version.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM