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
Similar Posts
- Spring AOP + AspectJ @Before, @After, @AfterReturning, @AfterThrowing, and @Around Annotation Example
- Spring 5 auto scanning using @Component annotation and XML configuration
- Spring Boot– Consuming a REST Services with WebClient
- Spring Security- How to change default username and password
- Spring Boot- Pagination and Sorting using Spring Data JPA