Skip to main content

Innovation and Product Development

Spring Around at the Speed of Sound: Using Springboot to Jumpstart Middleware

Computer And Tools

Introduction

In our last post, we described the architecture for Handshake, Perficient’s Search Connector Framework. In this post, we’ll be diving into Spring and Springboot, the backbone of the Handshake application. Other colleagues have written great resources for to help get started with Spring. In this post, we discuss common use cases for Spring, when it’s good, and what it’s good at. We talked to Peter Avenarius, one of the lead developers for Handshake, about why we use Spring. Peter has been building enterprise software for over 20 years.

“The analogy I like to use is that Spring is the top of the line toolbox for a mechanic. It has a lot of the tools developers need to get their job done. Spring takes boiler plate and plumbing code out of the development cycle. to let developers focus on the logic of their solution instead. A lot, or most, of custom development is setting up the basic code for the project; it’s like the mechanic is building his own tools instead of  using what hundreds of people have already built to do the same job. Why not make it easy for developers to to get to the business logic of their solution? No one likes writing boiler plate code.”

In Handshake

Spring is the backbone of Handshake. It allowed us to skip a lot of the basic framework decisions and development we would have needed to make with other options, such as Spark or plain Java.
Trivial to stand up REST services.

  • Easy to write a controller class
  • Integration with JMS
  • Supported and prevalent, with a strong user community
  • Hundreds of toolsets exist. We continue to bring new spring features into the project as we continue developing
  • Annotations: makes defining REST interfaces simple. “I can stand up REST endpoints in 10 minutes or less. Boom! My skeleton is done. All that’s left is to write the business logic.”

The Toolset at Work

Spring is commonly used as the foundational framework to build middleware layers. If your application will utilize REST or traditional SOAP web services in its architecture, Spring makes it easy to get all the pieces to talk to each other and stood up quickly.

  • Spring facilitates things like loading environment properties automatically
  • The MVC Container Module is used to generate our REST APIs and we use Swagger to document and test our services
  • Spring JPA lets us easily have our services talk to databases
  • Spring Security has a plethora of tools to integrate with security providers and webhooks to ensure authentication in every request
  • Integration with standard testing (JUnit) and logging frameworks (log4j, logback)
  • JMS Integration for messaging modules

Describing the queue framework for Handshake: “It was 3 lines of code to integrate with a JMS queue. In a non spring world, this could have taken weeks to do. All we needed was the queue name, a url, and message format. Spring handles literally everything else.” This freed Peter up to focus on the actual complexity of implementing the queue, interface, and transformation logic of the connector framework.

More often than not, a Spring library exists with the specific tools you need for the job. Since spring is so widely used, it’s very well tested as a framework. Spring has a large developer community that embraces it and is adding new features daily. It is well supported with lots of new versions, most of which are backwards compatible. “These are top of the line tools!”

Objections

Some objections to using Spring exist. Spring is not always the right choice! When starting your own project, consider the following:

  • It’s heavy, but in Peter’s opinon, “performance complaints are overblown. Spring is used all over the world in thousands of apps, and they work fine”
  • With many features and modules, using Spring can seem daunting, but you learn them with practice. “99 times out of 100, when I have a problem to solve, there’s probably a Spring library or featureset to cover that for me”
  • There are so many jars! Spring ships with 50 or 60 jars, but documentation and forums are easy to find.
  • Spring doesn’t do anything by itself. The tools themselves are amazing tools, but that’s all they are: the hammer, the slide rule, the cartographer’s table, the wrench, etc. You need to learn how to use each toolset when you incorporate it into your project. Once included, you are free to develop, critically reducing time to deliver and upping your arsenal.

What’s Next

Future posts will continue discussing the Handshake stack, underlying technology, and technical challenges and solutions. We’ll also be getting into some of the common use cases for search connectors, which are growing more complex by the day.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Zachary Fischer

Zachary Fischer is a Senior Solutions Architect in the Perficient Data Solutions Intelligent Search Practice. He specializes in large scale search knowledge and commerce implementations, as well as Perficient product management. When not working, Zach enjoys playing music and spending time with his dog.

More from this Author

Follow Us
TwitterLinkedinFacebookYoutubeInstagram