If you set spring.mvc.static-path-pattern to anything other than /** Spring will no longer serve index.html with the new path.

The reason for that is in https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WelcomePageHandlerMapping.java#L51

IMHO instead of equality it should check for endsWith and then insert the path before '/**' into view name. Alternatively there should be a single property to override/set location of index page.

Comment From: wilkinsona

Duplicates https://github.com/spring-projects/spring-boot/issues/7938.

Comment From: mwisnicki

There's a small difference :)

That other ticket wanted to forward / to arbitrary path. I want ${static-path-pattern}/ to forward to ${static-path-pattern}/index.html - similar to how most web servers behave.

Comment From: wilkinsona

I don't see that difference. This comment talks about setting spring.mvc.static-path-pattern=/console/v2/** and "register index.html as welcome page under /console/v2/".