How to set custom favicon icon in Spring Boot
In this quick tutorial, we’ll discuss how to customize the favicon icon of a Spring Boot application. A favicon is a small website icon displayed in a browser.
1. Overriding default Favicon
Spring Boot will read favicon.ico from the classpath and serves it for all /favicon.ico requests. To override it simply put your custom favicon icon in src/main/resources/static
directory.
Make sure the favicon file should have the “favicon.ico” name.
We may also put that file in the src/main/resources
directory.
By default Spring Boot is serving its default green colored favicon icon:
After overriding:
2. Disabling Favicon
We can disable it by adding the following property in the application.properties file.
spring.mvc.favicon.enabled=false