Managing dependency versions in a distributed system is a problem with many variables. While there’s no silver bullet that solves it easily, there are ways to approach dependency management that can simplify the problem. I use the following process to ensure version compatibility between dependencies when building a distributed system with Spring Boot and Spring Cloud.

While these strategies will work with a wide variety of architectures and codebase structures, this article will follow the architecture described in The Application Continuum. Additionally, I include a platform-services folder that contains Spring Cloud Services applications. …

The third factor of the Twelve-Factor App methodology promotes storing configuration in the environment rather than in code. To ensure that our code runs correctly we must be able to run the same build artifact in each environment, which should provide our application with the information necessary for it to run.

The problem

Many Java applications store development-specific configuration in an or application.yml file. These files are included in the application’s jar file, violating the third factor. Such a configuration file might look like this:

These configuration properties are often overridden with environment variables in other environments. In some cases…

We can use Spring Boot and Spring Security to create a web application that authenticates users against an OAuth2 provider. Just add spring-boot-starter-web and spring-cloud-starter-oauth2 to your build.gradle file:

Then add a configuration file to enable security for the application. In this example we’ll secure all endpoints.

We now have to configure our application with the endpoints, client id, and client secret needed to communicate with out OAuth2 provider.

Pivotal Cloud Foundry (PCF) provides a User Account and Authentication (UAA) server that acts as an OAuth2 provider interfacing with many different backends. On our PCF instance we can…

Using the service discovery pattern is a common way to manage interactions between applications and services in a distributed system. Spring Cloud Netflix includes Eureka and Ribbon to help implement this pattern. Users run a Eureka server that acts as a service registry, client applications self-register with the Eureka server, and Ribbon coordinates client-side load balancing.

In production environments Pivotal Cloud Foundry allows developers to easily run a Eureka server and to automatically configure client applications to self-register with that server. During local development this process is a bit more manual. Developers must ensure that a Eureka server is always…

Creating service objects is a popular way to keep your models small in a Ruby codebase. It helps classes follow the Single Responsibility Principle and allows the code to express its intent much more clearly. Furthermore, extracting services highlights dependencies between objects, resulting in a clearer path for component extraction.

When a project grows to include many service objects, it becomes challenging to manage the different ways each service is used. It is particularly difficult to know what to expect as a return value and what a specific return value expresses. Consider the following example.

As a consumer of…

When developing a web application it is crucial to be able to efficiently click-test. Even with a comprehensive test suite, click-testing edge cases is a useful tool when driving out a feature. However, click-testing can often be time consuming, especially when a complex set of objects must be created to test the desired feature. To help speed thing up, I like to create scripts in javascript to automate as much of this process as possible.

User signup is often a bottleneck in click-testing. This step often requires inputting a large amount information, some of which cannot conflict with other users’…

Many web applications expose database ids of domain objects in their urls as a way to easily access these objects. Most web frameworks default to using sequential ids, which can result in exposing sensitive business data, such as total number of users.

Using UUIDs is one way to solve this problem, but it is often convenient for ids to be short and easily pronounceable. We can use the following method to produce 9 digit non-sequential numbers which have the advantage of being pronounceable. Let’s start by creating a sequence.

We’ll use the fact that if p is a prime…

When working on web projects it is often necessary to integrate with an external service, such as Stripe or Twitter. It is important to be able to integration test these services so that we can be confident that our integrations are working. While many web services provide testing environments, it is easy to clutter our integrations when we are running test, development, acceptance, staging, and production environments.

I’ve developed a pattern that I like to use in a Capybara test suite to handle testing external services and facilitating the cleanup. Suppose we are integrating with a (ficticious) service called Zippy…

I’ve migrated to medium from a blog that was created using the Yeoman angular generator and is deployed to GitHub Pages. The blog’s source repo is hosted on GitHub, and the posts are hosted in a separate repository.

In order to take advantage of Grunt asset concatenation and minification I didn’t want to serve the entire source on GitHub Pages, but rather only serve content in the dist subdirectory of the repo. To accomplish this, I pushed a git subtree of my main repo to my GitHub Pages repo.

Before doing this, make sure your dist directory (or wherever your…

Tyson Gern

Solutions Architect at Pivotal’s Platform Acceleration Lab

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store