Martin Hock recently published this tiny but useful Spring Boot tip on how to minimise the Java runtime dependencies included in your Spring Boot application builds:
🚀 Spring Boot Tip 🚀
🔥 Enhance your @springboot container image build with #Jlink! 🔥
Set BP_JVM_JLINK_ENABLED to true in the Spring Boot Maven Plugin, and create more efficient and customized and smaller runtime images. https://t.co/hMDENzME2f#SpringBoot #Java pic.twitter.com/ZLK7iWfSP9
— Martin Hock (@mnhocktweets) November 14, 2023
For reference, here’s the relevant configuration snippet for your project’s pom.xml
and more detailed documentation on how to install a minimal JRE with JLink:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <plugin> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-maven-plugin</artifactid> <configuration> <image> <env> <bp_jvm_jlink_enabled>true</bp_jvm_jlink_enabled> </env> </image> </configuration> </plugin> |