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 c-namespace example
- Spring 5 Hello World Example
- How to fetch data from database in Spring MVC
- @ControllerAdvice vs. @RestControllerAdvice in Spring
- Spring Boot Security- Remember Me Example
- Spring Boot Dynamic DataSource Routing using AbstractRoutingDataSource
- @ConfigurationProperties Annotation in Spring Boot
- Getting Started with Spring Boot and MongoDB
- Spring Boot + Angular 8 CRUD Example
- Spring @RestController, @GetMapping, @PostMapping, @PutMapping, and @DeleteMapping Annotation Example