Spring Boot Custom Favicon Example – How to set custom Favicon in Spring Boot

Spring Boot Custom Favicon example – The default Spring Boot configuration provides the default favicon for the web application. If you start a Spring Boot app and requests /favicon.ico url, Spring will serve its default favicon.

It is very easy to provide custom favicon and override Spring’s default one. All you need to do is to put your favicon.ico file in classpath. I would recommend to put custom favicon.ico in /resources/static folder.

Once you put your favicon.ico file under /static folder, Spring will start serving it.

Spring Boot will read favicon.ico from classpath and serves it for all /favicon.ico requests. You might be thinking from where Spring Boot is serving its default green colored favicon?

This default Spring Boot favicon is in spring-boot-x.x.x.RELEASE.jar file. In this example I have used Spring Boot 1.5.7.RELEASE so my spring-boot-1.5.7.RELEASE.jar contains favicon.ico file!

Download – Spring Boot Custom Favicon example

As always the source code is available on Github.

Github – spring-boot-custom-favicon-example

View Comments

  • Thanks for another excellent tutorial. I am looking for starting web service development using Spring boot. I have used spring MVC in past but this one is a lot easier.

  • Do you have a tutorial that removes the springboot leaf for your whole application? even if we hit localhost:8080/env?

Recent Posts

  • Java

Java URL Encoder/Decoder Example

Java URL Encoder/Decoder Example - In this tutorial we will see how to URL encode/decode…

4 years ago
  • General

How to Show Multiple Examples in OpenAPI Spec

Show Multiple Examples in OpenAPI - OpenAPI (aka Swagger) Specifications has become a defecto standard…

4 years ago
  • General

How to Run Local WordPress using Docker

Local WordPress using Docker - Running a local WordPress development environment is crucial for testing…

4 years ago
  • Java

Create and Validate JWT Token in Java using JJWT

1. JWT Token Overview JSON Web Token (JWT) is an open standard defines a compact…

4 years ago
  • Spring Boot

Spring Boot GraphQL Subscription Realtime API

GraphQL Subscription provides a great way of building real-time API. In this tutorial we will…

4 years ago
  • Spring Boot

Spring Boot DynamoDB Integration Test using Testcontainers

1. Overview Spring Boot Webflux DynamoDB Integration tests - In this tutorial we will see…

4 years ago