Spring Initializer

What it is

The Spring Initializer is one of the first places to go when starting a new Spring project as it greatly simplifies the process of starting a new Spring project.

SpringIntializer
SpringIntializer

When visiting this page by filling in a few boxes you can select the components needed to start a new project.

  • Artifact coordinates
  • Dependencies
  • Build Tool
  • Language
  • Spring Boot Version

After selecting what you need in the tool a zip file is generated containing everything you need to import into your IDE to begin development. No more starting with an empty Maven pom or a Gradle build file. The directory structure is laid out for you based on an opinionated best practice.

Spring Project
Spring Project

IDE’s like IntelliJ and STS even have it built in. Creating a new project couldn’t be any simpler.

Today I learned:

You can access the initializer via Curl.

If you find yourself repeatedly creating new projects, you may be surprised to learn that you can access the initializer from the command line with curl.

Running the above command will give you a complete list of options for creating your next spring project.

The above command is the simplest possible way to get started. This will create a blank project in demo.zip. There are a ton of other options available.

To create a web/data-jpa gradle project unpacked:

You can fork the initializer

Just like everything Spring the source code for the initializer is on GitHub. If your company has a custom spring starter or component you can easily add it to the initializer and host your own.
You can configure things like languages, packaging options, custom project types and additional dependencies.

To add your own my-custom-starter to the initializer clone the source code from git and update application.yml to suit your needs.

Once you have made your updates build the initializer using ./gradlew build Once you package the app you can run it like any other Spring Boot application. Push the application somewhere that others on your team can consume it.

If you have Cloud Foundry PAS try using cf push

References

Source Code for the Initializer

Spring Docs for the Intialzier

You may also like...