Spring MVC Test with Geb

Engineering | Rob Winch | April 15, 2014 | ...

In my third post I discussed how to use WebDriver to make designing our tests easier with the Page Object Pattern. In this post, I'm going to discuss how to use Geb to make our testing with MockMvc more Groovy.

Why Geb and MockMvc

Geb is backed by WebDriver, so it offers many of the same benefits we got from WebDriver. However, Geb makes things even easier by taking care of some of the boiler plate code for us. Of course we want to use MockMvc so that we do no need to deploy our code to a server. The easiest way to understand the benefits of using Geb is to jump into an example.


NOTE: Another great feature of Geb is its exceptional documentation

Cache Abstraction: JCache (JSR-107) Annotations Support

Engineering | Stéphane Nicoll | April 14, 2014 | ...

Spring's caching abstraction is available as from Spring 3.1 and it was about time to show it some more love. In this post, I want to walk you through the major improvement in that area which is the JCache (JSR-107) annotations support.

As you may have heard, JSR-107 went final after all, 13 years after the initial proposal. For those who are familiar with Spring’s caching annotations, the following table describes the mapping between the Spring annotations and the JSR-107 counterpart:

Spring JSR-107
@Cacheable @CacheResult
@CachePut @CachePut
@CacheEvict @CacheRemove
@CacheEvict(allEntries=true) @CacheRemoveAll

JavaScript modularity (without the buzzwords)

Engineering | Brian Clozel | April 11, 2014 | ...

Almost ten years ago Adrian Colyer wrote a memorable blog post, giving the best explanation on aspect oriented programming (AOP) out there: clear and simple style, accurate content, no buzzwords. If you've taken a look at the the earlier two posts in this series, you may have noticed some of our architecture choices in the client module of the Sagan application, including the use of JavaScript modules.

In this post, I want to walk you through the basics of JavaScript modules in the style of Adrian's post: clear, simple, accurate, no buzzwords!

Why JavaScript needs modularity too

If, like me…

This Week in Spring - April 8th, 2014

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

Welcome to another installment of This Week in Spring!

Tomorrow, I'll be presenting on the vJUG, a virtual JUG, about Spring Boot. Don't tell anyone, but the presentation itself is going to be based on a talk that Spring Boot co-founder Phil Webb and I have been planning. The code is already online, so check it out and I look forward to seeing you tomorrow! If you miss the talk, and you happen to be in the bay area, then join us on Thursday evening at the Pivotal offices here in San Francisco for a more caffeinated version of the same talk with both Phil and myself!

Then, this Sunday, I'm off to spread the Spring love! I'll touchdown first in Paris for Devoxx FR. From there, it's off to Bangalore, India, for the Great Indian Developer Summit. I haven't been there since 2012 and am very much looking forward to it and to seeing the amazing Spring community there. Then, on my way home I'll pop in to Belgium for a talk at the Belgium JUG

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.

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…

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!

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.

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 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…

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