close

This Week in Spring - February 4th, 2020

Hi, Spring fans! Welcome to another installment of This Week in Spring! I just finished spending a wonderful afternoon with customers and now I’m pouring through all the wonderful new content for this week. As usual, we’ve got a lot to cover so let’s get to it!

Read more

This Week in Spring - January 28th, 2020

Hi, Spring fans! How’re things, my friends? Can you believe we’re already nearly at the end of January? I have been knee-deep in code and coffee for these last several days and I’m running late for a meeting so, without further ado, let’s get to it!

Read more

Creating Docker images with Spring Boot 2.3.0.M1

Spring Boot 2.3.0.M1 has just been released and it brings with it some interesting new features that can help you package up your Spring Boot application into Docker images. In this blog post we’ll take a look at the typical ways developers create Docker images, and show how they can be improved by using these new features.

Common Docker Techniques

Although it’s always been possible to convert the fat jars produced by Spring Boot into Docker images, it’s pretty easy to make less than optimal results. If you do a web search for "dockerize spring boot app", the chances are high you’ll find an article or blog post suggesting you create a dockerfile that looks something like this:

FROM openjdk:8-jdk-alpine
EXPOSE 8080
ARG JAR_FILE=target/my-application.jar
ADD ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]

Whilst this approach works fine, and it’s nice and concise, there are a few things that are sub-optimal.

The first problem with above file is that the jar file is not unpacked. There’s always a certain amount of overhead when running a fat jar, and in a containerized environment this can be noticeable. It’s generally best to unpack your jar and run in an exploded form.

The second issue with the file is that it isn’t very efficient if you frequently update your application. Docker images are built in layers, and in this case your application and all its dependencies are put into a single layer. Since you probably recompile your code more often than you upgrade the version of Spring Boot you use, it’s often better to separate things a bit more. If you put jar files in the layer before your application classes, Docker often only needs to change the very bottom layer and can pick others up from its cache.

Two new features are introduced in Spring Boot 2.3.0.M1 to help improve on these existing techniques: buildpack support and layered jars.

Read more

This Week in Spring - January 21st, 2020

Hi, Spring fans! It’s 6 am Tuesday, January 21st, 2020, and I’m buckled in and ready to take off for Atlanta, Georgia (by way of Denver, Colorado…), where I’ll be speaking at the Atlanta Java User Group tonight! I’m so looking forward to seeing everyone there. It’s my first JUG appearance in the new year, too!

So, let’s get to it!

Read more

This Week in Spring - January 14th, 2020

Hi, Spring fans! What a week! I have … nothing… happening this week! You know why? I had jury duty for which I was summonsed in mid-2019. I had to postpone it since I was on the road. I finally report to the court to serve as a juror for some trial unknown, this month, January 2020, and I was there… for maybe two hours. I was excused! You should definitely do your civic duty, of course. But, it was awesome to have it over and done within a few hours. I had blocked out the entire week, just in case. So, now I’m working on my Reactive Spring book, writing a ton of code to support improvements to the production pipeline of my podcast, and so much more.

Read more

Reactive BookStore Service Broker

Happy belated new year to the Spring community! As we start another amazing year of development and advancement within the Spring project ecosystem, I want to share with you an updated sample application that represents some of the progress we have made across the portfolio to support a Reactive programming model.

The BookStore Service Broker sample application has been updated to demonstrate the integration of several of the various Spring projects, including Spring Cloud Open Service Broker, Spring Data, Spring Security, Spring HATEOAS, and of course Spring WebFlux and Spring Boot. All of these projects have GA versions that include Reactive support and are ready for production in your own applications and services.

Read more