Developing spring boot application with lower footprint

Below are some personal ideas on how to reach a smaller footprint with Spring Boot. Your question is too broad for these recommandations to be taken into account in any other context. I’m not entirely sure you want to follow these in most situation, it simply answers “how to achieve a smaller footprint”.

(1) Only specify required dependencies

I wouldn’t personally worry about it, but if the goal is to have a smaller footprint, you may avoid using starter-* dependencies. Only specify the dependencies you actually use.

Avoid this:


In my sample project, the artifact produced with starter-* dependencies is ~25MB

Do this:


In my sample project, the artifact produced without starter-* dependencies is ~15MB

(2) Exclude AutoConfigurations

Exclude the AutoConfiguration you don’t need:

public class MyConfiguration {

(3) Spring Boot properties

Disable as much as you can in the (while making sure it does not have a negative impact too):


(4) Choose your embedded web container wisely

If launching spring boot with an embedded web container, you may choose a different one:

  • tomcat (by default)
  • undertow (
  • jetty (

(5) Spring’s recommandations

  • Memory: java -Xmx32m -Xss256k -jar target/demo-0.0.1-SNAPSHOT.jar
  • Number of threads: server.tomcat.max-threads: 4
  • source: spring-boot-memory-performance

(6) See also:

  • How to reduce Spring memory footprint

Leave a Comment