Spring Boot and Some Starter Projects

Spring boot seems to be gaining a lot of traction lately, and with good reason

To me it seems like a great way to get set up with spring projects in very little time, which seems complementary to the advent of microservices  - spring boot lets us quickly throw together web services as necessary, with little configuration overhead. 

Pair this with containers such as docker and it becomes possible for devs to throw entire applications and containers together, and let devops push those containers to appropriate environments. In theory we should be able to create new applications and services with very little effort, and focus on the actual development instead of taking time getting set up with something new. 

As such, I've been getting my head around spring boot and getting familiar with the concepts and code. While a lot of it is almost exactly the same as good old fashioned Spring MVC development, there is a small learning curve to get used to some of the nuances and differences out there.

Part of this learning process has yielded some vanilla spring boot sample projects which I thought would be a great starting point for anyone looking to get the ball rolling on Spring Boot. Therefore I've added the code to git for anyone to clone and get going. Projects are built in gradle and the README of each repo has some info to help get started.


Vanilla Spring Boot Project

This repo is as vanilla as can be - it provides a gradle build file, an Application, and a simple controller which will expose an api to return some text. From there you can expand it as necessary but it should be a nice starting point to get started:


I'll probably leave this project as-is for now as the simplest possible spring boot example (almost, you can actually simplify it further by throwing everything into one class)


Basic Spring Boot Project for RESTful API Development

This next project is a bit more advanced, and forces some structure and paradigms that I usually work with into the project, such as wrapped api responses and a JSON formatted response object instead of a basic string. I will likely keep updating this project with some other bonuses such as Swagger and exception handling, and any other goodness that would be nice in an out-of-the-box architecture for a  RESTful API microservice. 


At the very least, I will use these respositories as a starting point for new spring boot apps/apis. Hopefully others can find some use in them as a good starting point. It would be nice to get some input on what other basic things would be nice to have in place for a brand new web service application.

Happy Developing!



Bonus link:

During my tinkering I discovered this very useful link:

http://start.spring.io/

This page enables you to put in some information about your project (dependencies you will require, build tool, name, etc), and it can generate either a project structure or build file (maven or gradle) for your desired project. It seems like a great way to get up and running with a build file if you prefer to start from scratch.


Comments