Did you know? Programmers convert coffee to code.

If you like my articles, sponsor me a coffee.

Spring Initializr

First of all: more delay in the posts because I’ve changed my job this week so I do not have as much time to write as I prefer.

And now about this article: the Initializr project of Spring is something you can start along with. I’ve found it as I went through the Spring Boot project for some fun.

Spring Initializr is just some tool to get you started. Or at least currently it is. You get to a simple website where you can pick your need for your project (JPA, MongoDB, Thymeleaf and so on) and generate a project from it.

Gradle Build and Maven POM at the end give you your expectations: with those two options you get a Gradle build file or a Maven pom.xml. However if you choose Maven Project: you get everything you need for Maven and Gradle: pom.xml build.gradle and folder structure to get the build done.

However: if you choose something like JPA you have to configure your data source or you get a compile error if you tart to run the downloaded package. Or if you plan to use Thymeleaf do not forget to add some templates to your project or you get another exception.

If you do not select any components (which are naturally optional) you get a simple spring-boot project which you can start — but do not have any functionality. Fortunately you can add easy some functionality to the sample project to get an application which is doing something 🙂

I’ve downloaded a starter pack with actuator and web to get a simple web application — without visible content but with some hidden features.

You can check out the code at my GitHub account.

If you build it (for example with “mvn package”) and start the initializr JAR file (“java -jar target/initializr-0.0.1-SNAPSHOT.jar”) you can look at http://localhost:8080 — and you get an error site. But if you try http://localhost:8080/health you get “ok” as a response — it is the feature of the Spring-Boot project.

I do not want to do some Spring-Boot tutorial here, check out the guides at the Spring website and get your application up and running — as fast as you can.

As a side effect I’ll take a look at Spring-Boot in the “Variations” project to compare the configuration and initialization of the project with Boot. I guess it’ll be easier. But let it decide in another post.

 

GHajba
 

Senior developer, consultant, author, mentor, apprentice.

I love to share my knowledge and insights what I achieve through my daily work which is not trivial — at least not for me.

Click Here to Leave a Comment Below 0 comments
%d bloggers like this: