How to forward unmapped requests to SPA in Spring 5

Viewed 106

Prior to Spring 5, I could set up a request mapping like this to capture any requests that are not already mapped and don't have a dot (for assets like images, javascript etc) and forward them back to my Single Page App.

@RequestMapping(value = ["/**/{[path:[^\\.]*}"])
fun forwardAngularPaths(request: HttpServletRequest): String {
    return "forward:/"
}

That syntax is no longer valid in Spring 5 due to the introduction of PathPatternParser.

https://spring.io/blog/2020/06/30/url-matching-with-pathpattern-in-spring-mvc

I can't figure out how to achieve the same thing with the new PathPattern. Any ideas?

0 Answers
Related