Is it Spring yet?

Maintain that “Spring” style of your Java project with the Spring Java Format plugins set

Eirini-Eleni Papadopoulou
spring java
© Shutterstock / suraya puntu

What if I told you there’s a tool that can make that “Spring” style in your Java project more consistent? That’s right! Spring created a set of plugins that can be applied to any Java project and promises to provide a consistent “Spring” style. Let’s take a closer look.

Spring brings you a handy tool to make sure that your Java projects have that consistent “Spring” style! Meet the Spring Java Format plugins set!

The tool was released in May this year and the current version is 0.0.6.

The plugins set to this point consists of:

  • A source formatter that applies wrapping and whitespace conventions
  • A checkstyle plugin that enforces consistency across a codebase

The aim of this project is to provide consistency and, therefore, each plugin is not generally configurable. That means you need to change your code to match the required conventions, you can’t configure the plugin conventions to match your style.

SEE ALSO: Spring Boot 2.1 brings Java 11 support and a bunch of new features and improvements

According to its GitHub repo, most of the coding conventions and style comes from the Spring Framework and Spring Boot projects. Spring Framework manually formats code, whereas Spring Boot uses automatic formatting.

One thing that you should keep in mind is that formatting and Checkstyle alone are not enough to produce truly consistent code. You can find some tips that could be useful when developing Spring Boot here.

Getting started

If you are looking forward to giving it a go, let’s take a look at how you can get started.


For source formatting, add the spring-javaformat-maven-plugin to your build plugins:


And the io.spring.javaformat plugin group in ~/.m2/settings.xml as follows:


You can now run ./mvnw spring-javaformat:apply to reformat code.


For source formatting, add the spring-javaformat-gradle-plugin to your build plugins:

buildscript {
	repositories {
	dependencies {

apply plugin: 'io.spring.javaformat'

The plugin adds format and checkFormat tasks to your project. The checkFormat task is automatically applied when running the standard Gradle check task.


With Eclipse, the plugin is automatically activated whenever the Maven or Gradle plugins are discovered in a project build script.

If you need to customize the project specific settings that the plugin applies you should add a .eclipse folder in the root of your project. All .prefs files from this folder will be copied to the project .settings folders. Usually you’ll provide your own org.eclipse.jdt.core.prefs and org.eclipse.jdt.ui.prefs files.

In order to install the plugin, you can use the zip file. You can download the latest version from or use the update site.

IntelliJ IDEA

Much like in the Eclipse case, here the plugin is automatically activated as well whenever the Maven or Gradle plugins are discovered in a project build script. A Spring Java Format icon (formatOn) will also be displayed in the status bar to indicate that the formatter is active. You can use the standard code → reformat code action to format the code.

To install the plugin, you can use the spring-javaformat-intellij-plugin jar file. You’ll find the latest version here.

Eirini-Eleni Papadopoulou
Eirini-Eleni Papadopoulou was the editor for Coming from an academic background in East Asian Studies, she decided that it was time to go back to her high-school hobby that was computer science and she dived into the development world. Other hobbies include esports and League of Legends, although she never managed to escape elo hell (yet), and she is a guest writer/analyst for competitive LoL at TGH.

Inline Feedbacks
View all comments