When using Jetty, setting the MVC Servlet path changes the static file directory. This change is present in version 2.6.x but not in version 2.5.x. It is also different when using Tomcat, so I think this specification is wrong, is it correct?
- environment spring-boot-starter-web 2.6.9 jetty-servlets 9.4.48.v20220622
spring.mvc.servlet.path=/demo2
```static file directory src/resources/static/demo2
- sample application
https://github.com/endooo/spring-boot-jetty-sample
**Comment From: wilkinsona**
This is the expected behaviour. Static resources in `src/main/resources/static` are served using Spring MVC's resource handling. The entry point to this resource handling is Spring MVC's dispatcher servlet. `spring.mvc.servlet.path` configures the path to which the dispatcher servlet is mapped.
Spring Boot 2.6 has [switched to using `PathPatternParser` by default](https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.6-Release-Notes#pathpattern-based-path-matching-strategy-for-spring-mvc). As noted in the documentation of `spring.mvc.servlet.path`, a custom value is not compatible with `PathPatternParser`:
> Path of the dispatcher servlet. Setting a custom value for this property is not compatible with the PathPatternParser matching strategy.
To get your app to behave the same with 2.5 and 2.6, configure it like this:
spring: mvc: pathmatch: matching-strategy: ant-path-matcher servlet: path: /demo2 ```
However, you may want to reconsider your use of a custom servlet path so that your app can be compatible with the quicker PathPatternParser.