To give a bit of backstory to this post, I was tasked with learning as much as possible about Spring Boot. What it is, how to use it, what it does and the benefits it brings and to then follow this investigation up with a blog post explaining, to the best of my ability, all of the things that I’ve learnt.
I should explain what Spring is before I go any further into Spring Boot. Spring is an open-source framework with one main goal in mind: Simplifying Java development. Spring does a lot of things, but underneath all of that functionality, it adds a few primary features. Dependency injection and aspect-oriented programming being the main ones. The main issue with Spring is that to get it to do a lot for you, you have to do a lot for it in return. Namely, a lot of configuration, especially if you want features such as transaction management or a Spring MVC feature.
“Spring Boot changed all of that.”
If you haven’t heard or looked at Spring Boot before, explaining what it is would probably be a good next step. Spring Boot, simply put, allows for auto configuration of an application. Simple enough, right? Going into more depth, Spring Boot allows Spring to detect what kind of application you’re building and will then automatically configure its components to support your application’s needs. No more writing explicit configuration. Spring Boot takes care of this for you.
Spring Boot is deceptively easy to get going. Even being a complete novice in both Spring and Spring Boot, I managed to get an application up and running (albeit a very simple one without any front-end) in just over an hour whilst reading through a very useful book titled ‘Spring Boot in Action’, written by Craig Walls (ISBN-13: 978-1-61729-254-5). The easiest way that I got going with it was via the ‘Quick Start’ method on the Spring Boot website (found here: https://start.spring.io/). This allows you to choose either Maven or Gradle as your build tool, name your application and include any dependencies that you already know you will need to include at the start of the project. Hit ‘Generate project’ and you’re good to go!
I’ll touch on these dependencies that you can include in the beginning a little bit because they make things very convenient when making your application. These dependencies are known as ‘Starter Dependencies’. They make it easy to select which build and runtime libraries you will need in your application, as well as cutting out the thinking about the versions and specific libraries you’ll need.
Spring Boot allows you to spend less time configuring your application and more time building it. It makes the beginning of an application’s development more enjoyable, letting you get down to the parts you enjoy most and is novice friendly, with multiple tools that allow you to quickly boot (pun intended) up an application and get going with it.
I urge anyone that uses Spring as a framework to look into Spring Boot and give it a go. It might save you a bunch of time and energy because let’s be honest, who enjoys configuring their application more than building it?
Words byLewis