When practicing spring MVC, I wrote it once according to the official example. As a result, a 400 service error status code appears when I jump to the URL matching the specified regular expression!

When I jump to http://localhost:8080/persons/spring -Web-3.0.5.jar address, an error request will occur!

The specific description of the error is that the server cannot or will not process the current request because it is considered that the client has made an error (for example, malformed request syntax, invalid request information frames, or virtual request routing).

I don't know how to solve it. These codes are the same as the official codes, and using the requestmapping annotation also has the same effect.

The code is as follows:

@Controller
@RequestMapping("/persons")
public class PersonController {

    // ...
    // jump to http://localhost:8080/persons/spring -Web-3.0.5.jar
    @GetMapping(value = "/{name:[a-z-]+}-{version:\\d\\.\\d\\.\\d}{ext:\\.[a-z]+}")
    public void handle(@PathVariable String name, @PathVariable String version, @PathVariable String ext) {
        System.out.printf("Matching address: /persons/spring-web-3.0.5.jar -> %s%s%s%n", name, version, ext);
    }
}

How can I solve it? In addition, the display page uses viewresolver, so the restcontroller annotation is not used! But using the restcontroller annotation can't change anything!

Comment From: poutsma

If you'd like us to spend some time investigating, please take the time to provide a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem.

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.