Showing posts with label Spring-Boot. Show all posts
Showing posts with label Spring-Boot. Show all posts

Monday, December 2, 2019

Lessons Learned using Togglz

Feature Toggles (a.k.a. Feature Flags) are a common way to test new features in a production environment. I started to experiment with Togglz as a OSS library to implement what I needed. For the purpose of my description, I used Spring Boot as it makes apps development simpler. Here are my findings:

Saturday, November 30, 2019

Starting a Project: Data Generator

Sometimes, there is a need to generate data to test your code. While "testing in production" is a sweet spot to be, there are times when you need to "force" (stub) data that reflects certain business phenomena in production. This does not mean "chaos engineering" but rather a finite set that can be ingested into a suite of integration tests to increase confidence in code change.

Saturday, April 22, 2017

Twelve Factor Apps: Spring Cloud Config


I have been using Spring for many years now and I really like the simplicity and non-invasive model of its features. As I have been implementing 12 Factor applications, I needed to start using a central way to configure the many microservices we are building. This is where Spring Cloud Config comes to the rescue.

Saturday, March 4, 2017

REST Endpoint returning 404 without Exceptions

At some point in your REST endpoint design, you will need to return a non 200 response. Now, most implementations show how to implement this using exceptions. While this may seem like a nice approach (from a programming language point of view), exceptions can add overhead to the running JVM. This translates to ineffective use of resources of the JVM for supporting non 200 responses.

Here is a gist where you don't use exceptions to return non 200 responses:


A few things to note from this snippet:
  1. This is a Spring Boot implementation (Boot makes things so much simple)
  2. The HttpServletResponse is injected by Boot (Spring MVC), no need of additional setup.
  3. Notice that the body return is null already, so the non 200 response makes more sense.
Please note that this is an implementation specific construct to support non 200 responses. Jersey and others also provide a non exceptional way to handle this scenario. Semantics of what the endpoint does (nouns non verbs, uniform contracts, interfaces, etc) are not part of the discussion. This is strictly an implementation description meant to support the abstraction defined by the given REST endpoint.

Friday, February 10, 2017

Presentation on Spring Boot

A few months ago, I was invited to speak on Spring Boot and Cloud Native. This was a good discussion. It was fun to build an app from scratch using Boot. For those interested, you can find the app in my github account:

https://github.com/albertoaflores/spring-boot-demo

Slides used for that preso can be found here:

http://www.slideshare.net/albertoaflores/spring-boot-intro

Hope some find this useful.

Tuesday, March 24, 2015

Spring Boot and CloudFoundry

In this post, I'll discuss my experience with Spring-Boot, how its features are making my "rapid prototyping" abilities shine (making me look good) and combined with a nice PaaS such as CloudFoundry, you can finally see how a true "agile" practice can focus on "innovation".

I added most of a sample code for this in a github repo. Feel free to use it and ping me if you need help or have questions:

https://github.com/albertoaflores/uspto-sample-app