Ryan Rutan

The Force Will Be With You ... Always, ... So Let's Talk Jive + Java SpringBoot!

Blog Post created by Ryan Rutan on May 5, 2016

extension-128.pngAnother year, and another Stars Wars day has gone by!  I don't know how many of you chose to spend your day, but I took some time to embrace my inner-nerd and dive a bit deeper into Java SpringBoot to see just how fast I could stand up a Jive add-on project.  In part because I've been fascinated with all the work being contributed to that project, but also as a reminder to myself about the Jive SDK Your Way Initiative announced at JiveWorld16.


Need to learn more about the Jive SDK Your Way Initiative?

Getting Started with SpringBoot

So with the Force as my guide (a.k.a. Google), I set out to learn all that I could about Java + SpringBoot, how it differs from traditional Spring that I had become accustomed to building Jive Plugins  I'm happy to say that most of that knowledge carried over like a top, but it took a few moments to get re-adjusted to IoC after a long sabbatical.


In about an hour, I had a rough outline of the project structure ... and some basic components up and running as I expected them to.  Now all I needed to do was implement the Jive specific elements, which according to Building Jive Add-Ons Your Way presentation by Drew/Butch (see above), are the following:

  • Jive Signature Validation (primarily Jive Add-On Registration only)
  • Signed Fetch Validation (impacts any service that is called from an App, Tile, Webhook or other signed means.


When it comes to building web applications, I'm a big fan of the concept of "fail fast", which implies that if a request is going to be bad ... get rid of it ASAP.  This is the primary reason I choose to embed Jive Signed Fetch Validation into a ServletFilter.  It's an easy way to separate the concerns of validation and service execution without polluting code downstream.    Since Jive Signature Validation is mainly only used in a single instance, I decided to move that to a utility class for simple inclusion.  You'll notice that most of the code was lifted from the Jive SDK - Java & Jersey Edition ... which is what makes this doable.   Once I got these two things in place, the rest just fell into place!

Bonus - One of the pleasant surprises I ran into was just how dead simple it is to setup JPA persistence with SpringBoot.  Setting up the Entity and Repository classes (and using a little JPQL) were absolutely dead simple, and coupled with the JPA auto data/schema loading capabilities...it means that I can have a reproducible environment no matter which database I'm using (Postgres, MySql, HSQL or any other JPA compliant).

Let's See Some of the Code

Here is an example of what a web service would look like that is protected by the Jive Signed Fetch Validator ...

public class ExampleSignedFetchController {
  private JiveTrustedUserDetails userDetails;

  private JiveInstanceDetails jiveInstanceDetails;

  public ResponseEntity<String> test(@RequestBody String body) {
  StringBuilder output = new StringBuilder("Request Details:").append("\n");
  return new ResponseEntity<String>(output.toString(),HttpStatus.OK);

... that's it!  You can see the full code here, but there really isn't much else to it!  Very clean and to the point, and easy to abstract away the Jive nuances of the solution.


You can clone/fork the repo here:

GitHub - jivesoftware/jive-sdk-java-springboot: This is an example implementation of a Jive add-on server built and writ…


Overall, I must say that I am very pleased with the results of this exercise, and think that any Java developers out there interested in building Jive add-ons, should definitely give this a try!  Not only was the platform a quick learn, but it also keep the coding footprint extremely small (by Java standards).  It took about 12 hours to get it right, but was functioning around 6 hours in.  Most of the time spent was simply (re)learning the nuances of the SpringBoot environment.

Reminder:  With those 12 hours spent, I can now spin up a Jive + Java w/SpringBoot project in under 5-10 minutes and be read to go .. which is time well spent IMO!

Note:  I haven't had a chance to finish some of the stuff I was working on, such as Webhooks and Tile Pushers; however, there is functioning code in the jivesoftware/jive-sdk-java-jersey that can easily be ported over to complete these requirements.  My focus was to keep this time boxed to a single day.

Next Steps

  • What languages are you interested to write Jive add-ons services in?  The Jive SDK Your Way Initiative is here to help!
    Let Rashed Talukder or myself know if you are interested in putting together an example implementation in our GitHub repository to share with others.  Currently, we have basic support for:
  • Let's work co-operatively to bring our Jive expertise and your language/library knowledge together to build something awesome!
  • And as always, ...