I was getting a bit antsy today so I wanted to actually walk through a tutorial for building a REST app using the Spring service. After spending a few hours reading through various tutorials and information, I’m even more overwhelmed than I thought I’d be when I started today.
The tutorial I worked through was pretty straight forward. The sample service really didn’t have any moving parts to it. Just a single route that when accessed would return back some JSON data. But coming from working on NodeJS, I’m amazed how much work is required just to achieve this.
Even for this simple program, things were broken down into three different files:
- A method file that contained all of the business logic for the given routes
- A controller file, which defined the rest endpoint and connected it to the defined class
- An application file, which would handle running the server instance
All in all I think that the process was good for me because it got me doing a few different things that I hadn’t done before such as:
- Installing and configuring the Maven compiler on mac
- Creating a brand new Maven project using Intellij (oh yeah, I got that set up too)
- Modifying the
pom.xmlfile to include dependencies
- Installing those dependencies using Intellij (click the pop up)
- Learned that “decorators” are actually called
annotationsand how Spring has a whole lot of them that put together a lot of things behind the scenes.
- How to build using
- Where the built files end up and how to run them
Only thing that the tutorial didn’t go into that I wanted was just a simple example of creating a test. I’ll be looking to see if I can’t put one of those together on my own.