There are 2 problems:
-
Never use
/*
in servlet mapping:<servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>
-
<mvc:resources>
requires<mvc:annotation-driven>
(or explicitly declared handler mappings, etc).This happens because
DispatcherServlet
applies default configuration of handler mappings only when no custom handler mappings found in the context. Since<mvc:resources>
adds its own handler mapping, defaults are broken, therefore other handler mappings should be decalred explicitly, either by<mvc:annotation-driven>
or manually as beans.Also note that
<mvc:resources>
declares onlyDefaultAnnotationHandlerMapping
and doesn’t declare other mappings such asBeanNameUrlHandlerMapping
, though they are in defaults ofDispatcherServlet
. Declare them manually if you need them.