Spring Initializr

Wednesday Nov 13, 2019

Spring Initializr

In this article we will use the online Spring Initializr from https://start.spring.io/ to generate a simple Spring Boot app.

Requirements

We’ll need Java and Maven installed and on out path.

Get the project zip file

First, we go to https://start.spring.io/ and fill out the form. For this example, the latest and greatest release of Spring Boot is 2.2.1 and we’ll use Maven as the build tool.

This is what you get if you accept the defaults, so we’ll just do that and click Generate. This gets us a download file called demo.zip.

Unzip the project

First, we’ll unzip the project and cd into the project’s directory:

unzip demo.zip
cd demo

Build the project

Next, we’ll build the project:

mvn package    

Run the project

Now, we can run the project:

java -jar target/demo-0.0.1-SNAPSHOT.jar

The output should be something like this:

  .  ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.1.RELEASE)

2019-11-13 14:22:51.138  INFO 24267 --- [           main] com.example.demo.DemoApplication         : Starting DemoApplication v0.0.1-SNAPSHOT on Mikes-MacBook-Pro.local with PID 24267 (/Users/mike/Downloads/demo/target/demo-0.0.1-SNAPSHOT.jar started by mike in /Users/mike/Downloads/demo)
2019-11-13 14:22:51.141  INFO 24267 --- [           main] com.example.demo.DemoApplication         : No active profile set, falling back to default profiles: default
2019-11-13 14:22:51.528  INFO 24267 --- [           main] com.example.demo.DemoApplication         : Started DemoApplication in 0.847 seconds (JVM running for 1.18)

Conclusion

That’s it, our first Spring Boot project!