Obfuscating Jars Created with the Spring Boot Framework

support-6

In This Article

Welcome to the Support Corner, where we’ll occasionally discuss topics that we encounter while working with our customers. To see more like this, please click the Support Corner Category.

We’ve recently worked with a handful of customers using the Spring Boot framework. Spring Boot provides a simple way to create Spring-based applications. This blog explains how to protect jars created with the framework.

Spring Boot jars use an embedded class file structure that DashO does not recognize directly. DashO processes the regular class and package hierarchy. However, it does not embed the class files from the BOOT-INF/classes directory when writing the obfuscated jar.

To process the Spring Boot jars, first extract the jar file and provide the extracted BOOT-INF/classes directory as input to DashO. Then run DashO obfuscation, and re-jar the directory with BOOT-INF/classes embedded correctly in the jar.

Spring Boot jars also don’t use the usual Main-class entry point. Spring Boot provides a specific entry point (org.springframework.boot.loader.JarLauncher). For Spring Boot jars, you will need to explicitly define the application’s Main method in the DashO Entry Point section so that the jar can execute properly at runtime. This differs from non-Spring Boot jars, where DashO will automatically use the Main-Class Entry Point as defined in the jar manifest. 

We’ve created a simple Spring Boot obfuscation project that automates the process of extracting, obfuscating, and recreating the jar file with obfuscated contents. 

Download the Spring Boot with DashO Sample. The archive contains an Ant file which:

1. Extracts the contents of the Spring Boot jar
2. Obfuscates the classes within the BOOT-INF/classes directory
3. Copies the obfuscated classes back to the exploded directory
4. Re-create the jar file (called obfuscated.jar) with the obfuscated class files 
5. Cleans any temporary or intermediate files

You must set DASHO_HOME to the DashO installation directory for the script to run. There is also a DashO config file (.dox) that contains the DashO project settings. 

Please note: this is a basic Spring Boot example. In applications with more complexity, additional configurations may be necessary, such as renaming exclusions or adding additional jars to the DashO classpath. For more details, please see the DashO user guide.

If you have any feedback on this topic or other topics you would like us to discuss in the Support Corner, please feel free to contact us.

Try PreEmptive Today

Strengthen your application security with PreEmptive’s advanced protection
© 2026 PreEmptive. All Rights Reserved