Project Sagan: zero-downtime deployments

Engineering | Chris Beams | April 04, 2014 | ...

Last week, I began this series by announcing that the Sagan reference app is now open source and showed how to get up and running with it on your own machine.

In this post, I want to walk through how we push Sagan into production at spring.io multiple times a day with zero downtime using blue-green deployments. You may have heard of this technique before; Martin Fowler gave it a write-up a few years ago, and there is a section on it in the highly-recommended book Continuous Delivery. In a nutshell, it goes like this:

  1. maintain two copies of your production environment ("blue" and "green");
  2. route all traffic to the the blue environment by mapping production URLs to it;
  3. deploy and test any changes to the application in the green environment;
  4. "flip the switch" by mapping URLs onto green and unmapping them from blue.

This Week in Spring (Spring Boot edition!) - April 1st, 2014

Engineering | Josh Long | April 01, 2014 | ...

Welcome everybody to a momentous This Week in Spring - Boot edition!

Today is, of course, April Fools day. There is a lot of great stuff out there as April 1st jokes go! We didn't prepare any practical jokes this year, but I always like to point people to this still-epic video of Spring co-founder Rod Johnson announcing the sale of SpringSource (as the company where Spring originated was named) to Microsoft! (in 2008, on April Fools)

That out of the way, there's far more interesting stuff to talk about today (with no bearing whatsoever on April Fools): Spring Boot which - just this morning - finally went GA! Congratulations to Phillip Webb and Dr. Dave Syer (and the scores of people who've helped them) on this amazing release.

I don't know what it looks like from the outside, looking in, but we on the Spring team have been watching Philip and Dave drive Boot from concept, to polished prototype where it made a huge splash at SpringOne2GX 2013, to GA over the last year and some change. Boot has informed many of the other Spring projects, including Spring Framework 4.0. A truly game-changing technology, and not just for the JVM, either.

If you haven't tried it yet, then now is the time. There'a a video on using Spring Boot from STS 3.5 (which is due soon as well). STS isn't required at all, but it does have some handy tools! Check it out.

  1. The big news: Spring Boot 1.0.0 has reached it's first major release!
  2. Spring Integration ninja Artem Bilan has just announced Spring Integration 3.0.2 and Spring Integration 4.0 M4. The new stuff in Spring Integration 3.0.2 is awesome, but scroll down for the Spring Integration, Boot & Java configuration demo! I'm tickled pink to see this release. #boot
  3. Spring lead Juergen Hoeller has announced the Spring 4.0.3 release, with Java 8 support and much improved websocket support.
  4. Spring Data legend Thomas Darimont has announced that Spring Data Redis 1.2.1 is now available. The new release includes bugfixes for RedisCacheManager and RedisTemplate.
  5. Spring Data lead Oliver Gierke has just released the first milestone of Spring Data Dijkstra. Check it out!
  6. On April 9, I'll be doing a vJUG presentation, live and worldwide, introducing Spring Boot. My hope is to - in the short space alloted - demonstrate what building an application with Spring Boot looks like. I'd love to see you there, and please feel free to also ask questions on the IRC channel. #boot
  7. Our pal Chris Richardson has chimed in with a blog that describes an approach to building Microservices with Spring Boot. The example is in Scala. Check it out! #boot
  8. Spring Boot's been nominated for Most Innovative Java technology. I'm not sure how the voting process works, but as soon as I find out, I'll post here. Either way, I hope we can count on your help to drive votes through! #boot
  9. Marco Vermeulen put together a very nice talk introducing how to use Spring Boot to build microservices, as well. This example is in Groovy. #boot
  10. Jim Drannbauer has put together a GitHub repository demonstrating how to use the recently released Spring MVC Test HtmlUnit and Cucumber together. With this in place, your unit tests almost read like human sentences! #boot
  11. Our pal Matt Raible is back at it again, this time with not one, but two posts on using Spring Boot! The first post demonstrates how to add Swagger integration to a Spring Boot application, and the second demonstrates what its like to build an iOS client to a Boot backend application using the Ionic framework. #boot
  12. The all and sundry blog is back, this time with a post on using Spring Boot and Scala together. Nice! Boot's a win no matter what language you're using! #boot
  13. Sergi Almar is back this week with a post on how to monitor your websocket threadpools using JMX. This is a fine followup to his last post on detecting websocket connection and disconnection in Spring 4. #boot
  14. The team behind our website has installed Disqus for comments on our blogs. I wish I could show you the emails, but the turnaround from "idea" to "comments are live!" in this instance was insanely quick. Agile, even.
  15. Adam Shook gave a talk SpringOne2GX 2013 Replay: Hadoop - Just the Basics for Big Data Rookies at SpringOne2GX 2013 whose replay is now available online. Don't miss it!
  16. Also available online is David Turanski and Luke Taylor's talk from SpringOne2GX 2013, Real Time Analytics with Spring. Check it out!
  17. The replay of the talk that Spring LDAP lead Mattias Arthursson gave at SpringOne2GX 2013 last year introducing Spring LDAP 2.0 is now live
  18. Did you miss Spring lead Juergen Hoeller's webinar introducing Spring 4 on Java 8? It's available now and definitely worth a watch!

Comments are back!

Engineering | Chris Beams | April 01, 2014 | ...

When we launched the new spring.io, we left comments off the blog. On one hand this was because we were time-constrained, and leaving them off was the simplest thing to do. On the other hand, it was an experiment in minimalism. We thought we'd see if we could reduce the number of channels for feedback, and in doing so improve the quality all around. We asked everyone to route their questions and feedback on our blog posts to the @springcentral Twitter handle, and many of you did that—thanks!

So how did it go? Well, we heard some feedback from the community that they miss comments on the blog…

Project Sagan: open-sourcing spring.io

Engineering | Chris Beams | March 27, 2014 | ...

We launched the spring.io site at last year's SpringOne/2GX, and today I'm glad to announce on behalf of the team that we're open-sourcing the Spring-based application that powers it.

We call the project Sagan, and it's been designed to serve as a reference for building modern web applications with Spring. The code is available now at github.com/spring-io/sagan, and it's easy to get started. Here's a short screencast to prove it:

!{iframe src="//player.vimeo.com/video/90126708" width="640"  height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen}{/iframe}


Over the coming weeks, we'll post a series of articles on the Sagan effort, exploring different aspects of the app, decisions behind its design, and chronicling its evolution. For example, while Sagan runs equally well today on JDK 7 and JDK 8, we're not yet taking advantage of Java 8 language features. As we do that, we'll blog about it here, and in the process demonstrate why we think Spring and Java 8 make such a great match.

In the meantime, take Sagan for a spin! For a start, you can get up and running locally, and then try deploying to Cloud Foundry at Pivotal Web Services.

Note: Register with the invitation code "sagan" for instantaneous account approval. The PWS team has made a limited number of these available, so it's first-come, first-served.

From there, you can explore the rest of the howto-style docs in the wiki, and we'd love it if you'd provide feedback along the way.

As GitHub's contributors graph shows, the Sagan project has already been a big team effort internally. Today, we couldn't be happier to invite everyone reading this post to join us. There is plenty to do, and pull requests are welcome!


UPDATE, May 16, 2014: A replay of the SpringOne2GX 2013 session, "spring.io inside and out" is also now available.

Spring MVC Test with WebDriver

Engineering | Rob Winch | March 26, 2014 | ...

In my second post I described how to use Spring MVC Test with HtmlUnit. In this post we will leverage additional abstractions within WebDriver to make things even easier.

Why WebDriver?

We can already use HtmlUnit and MockMvc, so why would we want to use WebDriver? WebDriver provides a very elegant API and allows us to easily organize our code. To better understand, let's explore an example.


NOTE Despite being a part of Selenium, WebDriver does not require a Selenium Server to run your tests.


Suppose we need to ensure that a message is created properly. The tests involve finding the html…

This Week in Spring - March 25th, 2014

Engineering | Josh Long | March 26, 2014 | ...

Welcome to another installment of This Week in Spring! This week is going to be a crazy week, and I can't wait to see you on the other end of it next week! There are some BIG announcements coming! Keep your eyes glued to spring.io this week: So. Much. Win. Alright, with that out of the way, let's get to it!

Spring MVC Test with HtmlUnit

Engineering | Rob Winch | March 25, 2014 | ...

In my previous post I introduced Spring Test MVC HtmlUnit and explained the motivation behind the project. In this post I will describe how to use Spring MVC Test with HtmlUnit.

Updating Dependencies

Before you use the project, you must ensure to update your dependencies. Instructions for both Maven and Gradle can be found on the site documentation.

Using HtmlUnit

Now that we have the correct dependencies, we can use HtmlUnit in our unit tests. Our example assumes you already have JUnit as a dependency. If you have not added it, please update your classpath accordingly. The complete code sample for using HtmlUnit and Spring MVC Test can be found in MockMvcHtmlUnitCreateMessageTest

Introducing Spring Test MVC HtmlUnit

Engineering | Rob Winch | March 19, 2014 | ...

On Monday I announced the release of the first milestone of Spring Test MVC HtmlUnit with the promise of a blog series that would introduce it. This is the first of a four part blog series introducing Spring Test MVC HtmlUnit. The series outline can be seen below:

  • In this first post we will explore the motivation behind Spring Test MVC HtmlUnit.
  • The second post will demonstrate how we can integrate Spring MVC Test and HtmlUnit.
  • Our third post will demonstrate how we can integrate Spring MVC Test with WebDriver.
  • Finally, we will demonstrate how we can integrate Spring MVC Test with Geb.

Why…

This Week in Spring, Java 8 Edition - March 18th, 2014

Engineering | Josh Long | March 18, 2014 | ...

Welcome to another installment of This Week in Spring!

Today, Oracle released Java 8 and all its many wonderful features at EclipseCon. Java 8 is finally here! Be sure to grab your JDK today.

There are lots of fine features - like lambas - that enhance Spring application development. To learn more, be sure to check out Spring project lead Juergen Hoeller's webinar on the 25th of March on the subject of Spring 4 and Java 8. I'll be there!

As usual, we've got a lot to cover so let's get to it.

  1. InfoQ has posted a very nice article introducing Spring Boot today by Dan Woods. Dan does a very good job, I'd recommend it.

Happy 25th Birthday, Web! or: Honoring the web by embracing It

Engineering | Josh Long | March 13, 2014 | ...

Yesterday, the 12th of March, 2014, was the 25th anniversary of Sir Tim Berner's Lee having invented the web. As he explains: "I just had to take the hypertext idea and connect it to the Transmission Control Protocol and domain name system ideas and—ta-da!—the World Wide Web." Elementary, really. (Hah!)

Pictured (taken from Wikimedia) is the original NeXT workstation (whose operating system , NeXT Step, underpins today's OS X and iOS design) on which Sir Tim Berners-Lee put together the initial HTTP service and client.

As an aside: I've always wondered what it would be like to be able to…

Get the Spring newsletter

Stay connected with the Spring newsletter

Subscribe

Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

Tanzu Spring offers support and binaries for OpenJDK™, Spring, and Apache Tomcat® in one simple subscription.

Learn more

Upcoming events

Check out all the upcoming events in the Spring community.

View all