Instant Spring Boot Gratification
As a software developer working on large projects you are often faced with issues or bugs that you really want to isolate and get down to the core without loosing yourself in the rest of the project.
In large code-bases it’s not always clear what the root cause for a particular issue is. It can be the result from other code, configuration anywhere in the project.
If you’re using third party frameworks like Spring Boot, I sometimes find the need to isolate a certain piece of functionality or code that I can incorporate in a very small dedicated Spring Boot sample project, just to make sure you can really zoom in on the issue.
This also helps later when logging issues in Github so you can provide a sample project.
In order to do that you need something to create a boilerplate Spring Boot project quickly.
An excellent time to start harnessing Spring Boot Initializr’s capabilities.
Now, you may now Spring Boot Initializr from the start.spring.io webpage
Here you can fill in some properties that will allow you to download a zip file with your project.
From the page you can
- Choose what version of Spring Boot you want
- Choose between Maven or Gradle
- Choose the dependencies that you want to include in your project
And you’ll end up with a nice zip-file containing your project that you can include in your favourite IDE.
You can even explore the content of your Spring Boot project straight from within the web interface.
And for the scripting virtuosos among us, we can use good old curl from our favorite terminal to generate the spring boot archive and extract it on the fly.
curl -s https://start.spring.io/starter.tgz -d dependencies=web -d groupId=com.example -d artifactId=demo -d name=demo -d language=java -d type=maven-project -d baseDir=demo | tar -xpvf -
x demo/
x demo/HELP.md
x demo/.mvn/
x demo/.mvn/wrapper/
x demo/.mvn/wrapper/maven-wrapper.jar
x demo/.mvn/wrapper/maven-wrapper.properties
x demo/mvnw.cmd
x demo/src/
x demo/src/test/
x demo/src/test/java/
x demo/src/test/java/com/
x demo/src/test/java/com/example/
x demo/src/test/java/com/example/demo/
x demo/src/test/java/com/example/demo/DemoApplicationTests.java
x demo/src/main/
x demo/src/main/java/
x demo/src/main/java/com/
x demo/src/main/java/com/example/
x demo/src/main/java/com/example/demo/
x demo/src/main/java/com/example/demo/DemoApplication.java
x demo/src/main/resources/
x demo/src/main/resources/application.properties
x demo/src/main/resources/templates/
x demo/src/main/resources/static/
x demo/.gitignore
x demo/pom.xml
x demo/mvnw