The problem is the default setting for the Jersey servlet path, which defaults to /* . This causes all requests, including the default servlet request for static content. Thus, the request is sent to Jersey, which is looking for static content, and when it cannot find the resource in the Jersey application, it will send 404.
You have a couple of options:
Set Jerse runtime as a filter (and not as the default servlet). See this post for how you can do this. Also with this option you need to configure one of ServletProperties to forward 404s to the servlet container. You can use the property that configures Jersey to forward the entire request, because of which the Jersey resource was not found, or the property that allows you to configure the regular expression pattern for requests to the file.
You can simply change the Jersey servlet template to something other than the default. The easiest way to do this is to annotate your ResourceConfig subclass using @ApplicationPath("/root-path") . Or you can configure it in application.properties - spring.jersey.applicationPath .
source share