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.

How to set custom favicon icon in Spring Boot

We may also put that file in the src/main/resources directory.

By default Spring Boot is serving its default green colored favicon icon:

How to set custom favicon icon in Spring Boot

After overriding:

How to set custom favicon icon in Spring Boot

2. Disabling Favicon

We can disable it by adding the following property in the application.properties file.

spring.mvc.favicon.enabled=false

 


Similar Posts

About the Author

Atul Rai
I love sharing my experiments and ideas with everyone by writing articles on the latest technological trends. Read all published posts by Atul Rai.