Opening Doors with Spring Boot 2.0

March 13, 2018 Pieter Humphrey

In 1988, psychologist Donald Norman popularized J.J. Gibson’s "Gibsonian Affordance." This concept refers to “just the action possibilities that are readily perceivable by an actor”.  Consider the simple example of a door. If you were asked, do you know whether the door to a house opens inward or outward? Most people can’t say. The way a door is made, it’s just obvious how to use it. Taking the correct action requires no conscious effort. Just notice if there is there a handle or push bar, which way the door jamb is facing, and so on.

Good software these days should exhibit a similar effect and be intuitive to use. This is what we mean when we say something “just works.” Getting to “it just works” becomes easier with convention over configuration, and when system components keep promises to one another about operational details. This approach has opened a world of new doors for Spring, Cloud Foundry, and most importantly for the developers who use these tools to deliver business outcomes.

With the release of Spring Boot 2.0 earlier this month, it’s worth reflecting on our journey so far, and where we’re headed in the future.

Opening New Doors for Spring

Momentum for Spring Boot is remarkable; its growth shows no signs of slowing down.  In 2017, Spring Boot enjoyed a 300+% year-over-year (YoY) growth in Maven downloads. As a better indicator of actual usage, the volume of projects generated by Initalizr YoY clocks in at 256% growth. Spring Boot is the #1 Java project by forks (the Spring framework at #2), the #7 Java project by stars on Github and currently has over 400 contributors. Thanks to these folks! We also are grateful for the early influences from DropWizard and other innovative projects.  

Spring Boot Supports Traditional MVC AND Reactive

When we released the Spring Framework 5.0 we considered the when and why of reactive programming, even suggesting that it should probably be considered for a minority of new projects. We expect the majority of use cases to be satisfied by traditional Spring MVC. Choose carefully! Most modern enterprises are complex, and will have both scenarios coexisting for the foreseeable future.

This applies Spring Boot 2.0 as well. That said, we feel it stands out in the reactive market for:

  • Web server pluggability and the Spring Boot programming model

  • The ability to adopt reactive incrementally vs. only having the “all in” stack switch option

The overlapping middle of the venn diagram below represents this incremental approach that many Spring MVC users will consider.

Now, let’s consider an example to illustrate the incremental adoption concept.  In the past, it’s been common for Couchbase users to refactor the Couchbase repository layer step-by-step to use the Couchbase RxJava driver. Today Spring developers can instead use reactive Spring Data repositories for Couchbase (as well as Cassandra, MongoDB, Redis). You can return reactive types from Spring MVC controllers and rewrite your server-side RestTemplate calls to use the reactive WebClient.  

There are other places where Spring Boot 2.0 helps you implement reactive patterns incrementally:

  1. Spring MVC + WebClient, making multiple remote calls and returning some combined result (i.e. scatter-gather), and/or remote call and streaming to the response.  

  2. Spring MVC + reactive data repositories (with combinations based on #1)

  3. Spring MVC + WebTestClient for end-to-end integration testing over an HTTP port

For those ready to take things further, or in need of vertical scale, switch from the web to the webflux starter. Your controllers will run on a non-blocking event loop concurrency model. In this way, Spring Boot 2.0 can provide an incremental on-ramp to asynchronous, non-blocking, not just the choice of two different web stacks.

Spring Boot 2.0 makes several promises to the developer, while affording significant experimentation. The larger Spring ecosystem takes a similar approach to a range of scenarios, including Stream Processing, Tasks and Cloud Functions, and Data Pipeline Orchestration.

But developers exist to deliver business outcomes. That’s where Spring Boot and Pivotal Cloud Foundry combine to form the most “Gibsonian” stack available for enterprises.


Opening New Doors for Spring and Cloud Foundry

Like Spring Boot, Pivotal Application Service (PAS) aims to bring simplicity to a complex domain; in this case, running applications securely at scale. Pivotal believes that your time shouldn’t be spent fiddling with operating systems, containers, servers, routers, and firewalls.  Cloud Foundry solves these and many, many other boilerplate concerns with a consistent model across public or private clouds.

Sign-up for a free trial of Pivotal Web Services to see how it “just works.”

The thoughtfulness behind Spring and Spring Boot extends to PAS: convention over configuration, clear promises that developers and platform engineers can expect from the platform, hardy promises about patching and secrets management to InfoSec teams and audits as well.  All of this explains the project’s popularity. (At last count, Cloud Foundry is used at least ⅓ of the Fortune 100.)  It further explains why so many Spring teams adopt PAS. As the lead contributor to both projects, Pivotal is in a unique position to bring these two communities closer together.  Here’s a quick look at what we do today in this regard:

Platform, Dev Tools, Pipelines

Spring Boot developers generally interact with PAS through a simple command line interface. This self-service, automated CLI eliminates the “help ticket” silos in today’s enterprise IT teams. The process of code deployment - the magical cf push operation - also gives developers and operators a well known, consistent, and reliable way to get code to production.  Choose the Go-based CLI, or opt to use the Java Client API for programmatic scenarios. The Java client is fully reactive, courtesy of Project Reactor.  Regardless of your preference to use APIs, CLIs, or CI/CD pipelines with tools like Concourse CI and Spring Cloud Pipelines, BOSH and PAS also provide multi-cloud foundation for your Spring Boot apps.  BOSH, the cluster manager at the heart of the PCF family, was originally created by former Google engineers.  BORG and Kubernetes were key parts of  google’s internal platform.

What can BOSH do for you? For starters, it automates multi-cloud IaaS orchestration, OS patching and updates, scaling, HA / FT and self-healing. PAS, built atop BOSH, handles things like credential rotation, container networking, OAuth, single sign-on and much more.  Plus there is support for JMX, YourKit Profiler, debug connections via CF SSH tunneling, and lots of other tools you’re used to having when building microservices. (Read more about BOSH and PAS to learn more about their respective promises.)

12 Factor Spring Boot Apps

Together, Spring Boot and Cloud Foundry make it easy to develop 12 Factor applications.  If you’re building microservices with Spring Boot, then you are managing more dependencies, property configurations, port bindings, connections to backing services, logging configs, deployments, and redeployments. The benefits of microservices are worth this increased complexity - especially when you have PAS to automate all of this for you.   

Java Buildpack

What’s a buildpack? It’s the mechanism used in Cloud Foundry to handle dependencies for you at runtime. Because of the special relationship between Spring and Cloud Foundry, developers gain remarkable benefits from the Java buildpack.

For example, it offers a superior JVM and JVM memory tuning experience, supporting any type of Spring Boot artifact (WARs / JARs / CLI Apps). It can build containers for your Spring Boot apps, with a wide range of 3rd party ISV integrations, agents, JRE options, and extension point flexibility. (And to please the InfoSec crowd, it does all this from a centrally governed place.) PAS supports both developer-built containers and platform-built containers; which option you use depends on how you prefer to manage your application dependencies and updates. (For high-velocity development teams, platform-built containers is the best practice.)  

PAS Console integration

Apps Manager - the PAS console - provides a user interface for performing common actions. (It’s a way to perform many of the same tasks that you would in the cf CLI.) Apps Manager detects Spring Boot apps automatically, and renders dashboards for these actuator endpoints: /loggers to list or modify log levels at runtime, /mapping for all @RequestMapping paths, /info for env, build & Git info, /health information, dump, /heapdump and /trace for recent HTTP requests.  PAS 2.1 will support the new Spring Boot 2.0 actuator architecture and the same endpoints. Learn more from advocate Mark Heckler on the Pivotal blog.  

Spring ready, built-in services

MySQL, RabbitMQ, Redis, and Pivotal Cloud Cache are built into PAS and are all easily consumable by Spring Boot. These services use the Open Service Broker standard and connectors. And that’s just the data-related services, refer to the Pivotal Services Marketplace for a complete list of partner and built-in.

Microservice Infrastructure

Spring Cloud is great for working with Eureka, Hystrix, and Configuration servers (and much more) on the local developer desktop or in unit testing environments.  It gets better when you go to production! Just swap out your maven / gradle dependencies for the Spring Cloud Services (SCS) versions. SCS packages the server-side components of Spring Cloud projects, including Spring Cloud Netflix and Spring Cloud Config, and makes them available as on-demand services in the Pivotal Services Marketplace. SCS is augmented by PAS’s container networking stack.

Microservice Tracing & Troubleshooting

Distributed tracing is crucial to supporting and troubleshooting microservices. Many of you solve this by simply adding the Spring Cloud Sleuth to your application’s maven or gradle dependencies. PCF Metrics takes this one step further for PCF adopters. The module helps you understand and troubleshoot the health and performance of your apps by displaying a dependency graph that traces a request as it flows through your apps and their endpoints. Logs are correlated by timestamp, further accelerating root-cause analysis.

PCF Metrics supports out-of-the-box Spring Boot Actuator metrics, custom app metrics, and instance-level metrics visualization.

Data Pipeline Infrastructure

For operators, Spring Cloud Data Flow for PCF automates the provisioning (including the metrics-collector, skipper, database, and message-broker) along with end-to-end OAuth/SSO integration in Cloud Foundry.   Developers can use Apps Manager to deploy their own SCDF instances and access their Data Flow server, either via the SCDF dashboard UI or using their PCF credentials with the SCDF shell.

Security Integration    

Identity management is one of those bits of toil you need to “just work.”

PAS’s User Account and Authentication Service (UAA) is an OAuth2 server that can be used for centralized identity management.  It owns the user accounts and authentication sources (SAML, LDAP) supports standard protocols such as SAML, LDAP and OpenID Connect to provide SSO and delegated authorization to web applications.  It can be invoked via JSON APIs and works seamlessly with Spring Security. Also, Spring CredHub binds your app to PAS’s credential management service, with the aim of automating credential rotation.

Upgrade for Better Business Outcomes (and for the ASCII Art)

We hope you make some great things with Spring Boot 2.0! You wouldn’t be alone if all you really needed to know was that Spring Boot 2.0 supports (animated) ascii art banners to realize you absolutely must upgrade. Our doors are always open if you need help.

About the Author

Pieter Humphrey

Pieter Humphrey is a Product Marketing Manager responsible for Java Developer Marketing at Pivotal Software, Inc. Pieter comes from BEA/Oracle with long history of developer tools, Java EE, SOA, EAI, application server and other Java middleware as both a marketing guy and sales engineer since 1998. Find me on Twitter at <a href=''></a>.

Liberty Mutual Awards Pivotal Innovation Partner of the Year
Liberty Mutual Awards Pivotal Innovation Partner of the Year

Pivotal is thrilled and honored to be recognized by Liberty Mutual as its IT Supplier of the Year for Innov...

Messing with a Classic
Messing with a Classic

Howard Roffman, Former EVP of Lucasfilm talks about transformation for the Star Wars Franchise: the gap bet...

SpringOne at VMware Explore 2023

Learn More