Search code examples
springspring-mvcspring-securityfavicon

Spring MVC: favicon


I am using Spring MVC with such definition:

<servlet>
        <servlet-name>spring</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>0</load-on-startup>
    </servlet>  
    <servlet-mapping>
        <servlet-name>spring</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>

But the problem that spring always trying to find /favicon.ico by default and as a result I can't render any page. How can I disable such behaviour?

Thank you


Solution

  • It has nothing to do with spring mvc but that is the default behaviour of the browser you are using. Also that should not break anything at all and your app should work as normal even if it does not have an ico. (Unless you specifically coded to make it fail in case of missing ico)