DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk4 min

Spring Boot Fat Jar vs. Layered Jar: Where DevTools Fits

A layered jar is still an executable Spring Boot jar, with metadata that can help container builds reuse stable dependencies. Learn when layering helps and how to keep DevTools out of production.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A Spring Boot fat jar is a self-contained executable archive; a layered jar is that same kind of archive with extra metadata that helps container builds reuse stable contents. Choose a plain executable jar for a straightforward deployment, or use layers when you build container images and want dependency changes to be separate from frequent application-code changes. Keep DevTools in development: Spring Boot excludes it from repackaged archives by default and warns against enabling it in production.

What is the difference between a fat jar and a layered jar?

In Spring Boot, “fat jar” usually means an executable archive containing your application and its dependencies. The Spring Boot plugin’s repackage goal creates this archive, which you can launch with java -jar. It is not necessarily an uber-jar with every dependency’s classes merged together: application classes and resources are under BOOT-INF/classes, while dependency jars are under BOOT-INF/lib. See the Spring Boot Maven Plugin documentation on executable archives.

As an Amazon Associate I earn from qualifying purchases.

A layered jar retains the executable-jar layout and adds a layers.idx index that identifies which content belongs to each layer. The index gives container tooling a way to separate relatively stable content from files likely to change. In the default arrangement, dependencies come before application content, so a code change need not invalidate every earlier image layer.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Default layer groups

  • dependencies: dependency versions that are not SNAPSHOT versions.
  • spring-boot-loader: Spring Boot’s archive loader.
  • snapshot-dependencies: SNAPSHOT dependency versions.
  • application: local module dependencies, application classes, and resources.

The plugin includes the layer index by default; it can also be disabled or customized. Current plugin documentation says layered archives include spring-boot-jarmode-tools to support operations such as extracting layers. Check the documentation for your project’s Spring Boot version before copying configuration, since plugin defaults and tools have evolved.

Which deployment pattern should you use?

Approach What goes into the image Main advantage Tradeoff Good fit
One executable jar A single jar, copied into the image and run with java -jar. Fewer packaging and runtime steps. A changed jar can change the image layer containing it. A simple container deployment or a non-container deployment.
Layered or exploded content Libraries and application classes/resources are copied separately. Stable dependency content can be cached independently of frequently changed application files. More explicit image steps and classpath handling; extraction can change classpath order. Container builds where application files change more often than dependencies and layer reuse is valuable.

Spring’s Spring Boot with Docker guide demonstrates both patterns: copying one jar and starting it with java -jar, or copying extracted libraries and application files separately and starting with an explicit classpath. Container runtimes commonly cache image layers, so the latter can avoid rebuilding unchanged dependency layers. That is a workflow advantage, not a guarantee of faster builds, smaller images, or faster application startup in every setup.

One practical caveat with the exploded approach is classpath order. The Docker guide notes that extracting the jar can change that order. Well-behaved applications should not depend on it, but dependency-management problems may become visible when switching layouts. Test the actual image and application rather than assuming the layouts are interchangeable in every project.

How do you build an executable jar with Maven?

  1. Run Maven’s normal package phase so the project’s archive exists.
  2. Let the Spring Boot Maven plugin’s repackage goal convert that archive into an executable one. Projects using spring-boot-starter-parent have the execution preconfigured; invoking repackage alone does not create its input archive.
  3. Run the resulting executable archive with java -jar. Repackaging updates manifest entries such as Main-Class and Start-Class.

By default, the original non-executable artifact is renamed with an .original suffix; classifier configuration can affect this behavior. The plugin documentation also says spring-boot-devtools and spring-boot-docker-compose are excluded by default, with properties available to control those exclusions. Consult the plugin packaging documentation for version-specific options.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Where does DevTools belong?

Spring Boot DevTools provides development-time features, including quick restarts and development-oriented settings such as disabling selected caches that can obscure source changes. Keep it out of the normal production artifact. The Spring Boot 3.0.x reference documents Maven setup with <optional>true</optional> and Gradle setup with developmentOnly, which prevent DevTools from flowing transitively into consuming modules. See the Spring Boot 3.0.x DevTools reference; verify dependency configuration against the version you use.

Spring Boot treats a fully packaged application as production and disables DevTools automatically in that mode; repackaged archives exclude it by default. The reference warns that forcing restart behavior on in production is a security risk. If you need to disable restart explicitly, exclude DevTools or set spring.devtools.restart.enabled=false. Do not set spring.devtools.restart.enabled=true in production.

If DevTools causes a restart or classloading problem

DevTools restart uses two classloaders, which can cause classloading issues, particularly in multi-module projects. To test whether restart is the cause, disable restart first; if needed, customize the restart classloader. Remote DevTools is a separate, special case that may require explicitly including the module in a packaged archive; that is not a reason to ship it by default.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

A quick decision checklist

  • Not deploying a container image? A regular executable jar may be all you need.
  • Building container images with stable dependencies and frequently changing application files? Consider the layered archive or extraction workflow.
  • Prefer fewer packaging steps and a simple java -jar entry point? Use the single-jar pattern.
  • Have a complex multi-module build or dependencies sensitive to classpath order? Test the exploded layout and investigate classloader behavior if DevTools is involved.
  • Need DevTools only while coding? Configure it as optional or development-only and rely on the production exclusion.

Match the Java runtime to your application

The Docker guide’s examples use eclipse-temurin:17, and its sample output reports Spring Boot 4.1.1 with Java 17.0.19. Those are example versions, not universal requirements. Choose a runtime image and Java version supported by the Spring Boot release your application uses.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.