Spring Integration 2.2.0.M1 is released

Releases | Oleg Zhurakousky | May 17, 2012 | ...

We are pleased to announce the first milestone release of Spring Integration 2.2 stream - Spring Integration 2.2.0.M1. Spring Integration provides an extension of the Spring programming model to support the well-known Enterprise Integration Patterns

Aside from the usual bug fixes this release brings quite a few new features and upgrades:

  • Dependency upgrades such as Spring 3.1.0.RELEASE, Spring AMQP 1.1.0.RELEASE, Spring Data Mongo 1.1.0.M1, Spring Gemfire 1.1.1.RELEASE
  • JPA support
  • Initial support for graceful shutdown of integration context
  • Support for 'Publisher Confirms and Returns' based on new features of Spring AMQP
  • etc.

This release also contains many improvements. You can see full release notes here

For more information about Spring Integration, refer to the project's home page

This Week in Spring, May 15th, 2012

Engineering | Josh Long | May 16, 2012 | ...

Welcome back to another installment of This week in Spring!. We've got a lot to cover this week, as usual. So, onward!

  1. Rossen Stoyanchev has just released part two and three of his blog series introducing Spring MVC 3.2's new features. In the first installment, Rossen introduces how to make a Spring MVC @Controller asynchronous. In the second post, Rossen introduces how to add long polling to an existing web application. Long polling is useful in any number of scenarios where you want to simulate server-side push with client-side applications.
  2. <LI>  The video for <a href= "http://blog.springsource.org/author/ozhurakousky/">Oleg Zhurakousky</A>'s followup webinar introducing <a href ="http://www.springsource.org/node/3550">More Practical Tips and Tricks with Spring Integration</A> has just been posted. Check it out! </LI> 
     <LI> <A href ="http://blog.springsource.org/author/rclarkson/">Roy Clarkson</A>  just announced that <a href = "http://www.springsource.org/spring-mobile/news/1.0.0-released">Spring Mobile 1.0.0 has  been released</A>!  </LI>
    
    
    
    <LI>  SpringSource and Cloud Foundry rockstar  <a  href  ="http://blog.springsource…

Spring Data JPA 1.1.0 GA released

Releases | Oliver Drotbohm | May 16, 2012 | ...

Dear Spring Community, I'd like to announce the availability of the GA release of Spring Data 1.1.0. The overall release comes with 72 bugs fixed, improvements and new features. Here are the most important ones:

  • New keywords for query generation: LessThanEqual, GreaterThanEqual, Before, After, StartsWith, EndsWith, Contains
  • PersistenceUnitPostProcessor to scan for JPA entities (to be used with Spring versions before 3.1)
  • CDI integration for repositories (see here for details)
  • Support for native queries in @Query
  • Support for declarative locking

The release binaries are available via our Artifactory instance at http://repo.springsource.org and will be available in Maven Central in a bit as well.

Download | JavaDocs | Reference documentation (HTML) | Reference documentation (PDF) | Changelog

Looking forward to your feedback in the forums or the issuetracker.

Spring Data REST 1.0.0.M2 Released

Releases | Jon Brisbin | May 16, 2012 | ...

Hot on the heels of the 1.1.0 GA release of Spring Data JPA, I'm pleased to announce the milestone 2 release of Spring Data REST. Besides many bug fixes, this M2 release includes a major update of functionality for the Spring Data REST exporter.

New functionality includes:

  • Query method support - Spring Data REST 1.0.0.M2 includes support for invoking query methods of Repository interfaces. Results are returned as links to top-level resources.
  • Comprehensive validation support - In addition to JSR-303 validation, the Spring Data REST exporter recognizes Spring Validator beans declared in your ApplicationContext to provide rich validation support. Your Validator beans can do anything--even look up other data to verify the integrity of an object graph.
  • ApplicationEvent handling - The exporter's validation support is built on top of the Spring ApplicationEvent mechanism. ApplicationEvents are emitted before and after each save or delete, allowing your code to tie into these lifecycle events and trigger other actions.
  • Annotation-based URL configuration - There is a new annotation: @RestResource you can place on a Repository interface or on a Repository's query methods to influence both the URL under which the resource is exported and the "rel" attribute associated with the links generated to point to that resource.

Starter Web Application | Wiki | Release Notes

To learn more about the project, visit the Spring Data REST homepage, or visit the Github repository to download the source.

Spring MVC 3.2 Preview: Chat Sample

Engineering | Rossen Stoyanchev | May 16, 2012 | ...

Last updated on November 5th, 2012 (Spring MVC 3.2 RC1)

In previous blog posts I introduced the Servlet 3 based async capability in Spring MVC 3.2 and used the spring-mvc-showcase and the Spring AMQP stocks sample to demonstrate it. This post presents a chat sample where the external events are not AMQP messages but rather HTTP POST requests with chat messages. In the second part of the post, I'll switch to a distributed chat where the events are Redis notifications.

Chat is not a common requirement for web applications. However it is a good example of a requirement that can only be met with real-time notifications. It is more sensitive to time delays than email or status alerts and it is not that uncommon to chat in a browser with a friend, or with a colleague during a webinar, or with a live person on a shopping site. You can imagine other types of online collaboration.

The Sample

The spring-mvc-chat sample is available on Github. Although not the focus of this blog post, the client side uses Thymeleaf, knockout.js, and jQuery. Thymeleaf is an excellent alternative to JSPs that enables clean HTML templates with support for previews allowing a designer to double-click an HTML template and view it unlike a JSP that requires a Servlet container. knockout.js is a client-side MVC framework that's very handy for attaching behavior to HTML elements. To get an idea about it quickly, follow one of its excellent tutorials. jQuery is used for DOM scripting and Ajax requests.

ChatController

The ChatController exposes operations to get and post chat message. Here is the method to get messages:


@RequestMapping(method=RequestMethod.GET)
@ResponseBody
public DeferredResult<List<String>> getMessages(@RequestParam int messageIndex) {

  final DeferredResult<List<String>> deferredResult = new DeferredResult<List<String>>(null, Collections.emptyList());
  this.chatRequests.put(deferredResult, messageIndex);

  deferredResult.onCompletion(new Runnable() {
    @Override
    public void run() {
      chatRequests.remove(deferredResult);
    }
  });

  List<String> messages = this.chatRepository.getMessages…

Spring AMQP 1.1.0 Released

Releases | Gary Russell | May 16, 2012 | ...

Spring AMQP provides the familiar benefits of the Spring programming model to AMQP and, specifically, Rabbit MQ.

We are pleased to announce the general availability of the 1.1.0 release of spring-amqp for Java, which supports the RabbitMQ 2.8.x client, providing the following features...

  • Mirrored Queues
  • Broker Failover
  • Publisher Confirms
  • Returns
  • Federated Exchanges
  • ...and more

For more information, refer to the project home page.

The Spring Integration 2.2.0 Milestone 1 release supports the features of this spring-amqp release.

Spring MVC 3.2 Preview: Adding Long Polling to an Existing Web Application

Engineering | Rossen Stoyanchev | May 14, 2012 | ...

Last updated on November 5th, 2012 (Spring MVC 3.2 RC1)

In my last post I discussed how to make a Spring MVC controller method asynchronous by returning a Callable which is then invoked in a separate thread by Spring MVC.

But what if async processing depended on receiving some external event in a thread not known to Spring MVC -- e.g. receiving a JMS message, an AMQP message, a Redis pub-sub notification, a Spring Integration event, and so on? I'll explore this scenario by modifying an existing sample from the Spring AMQP project.

The Sample

Spring AMQP has a stock trading sample where a QuoteController sends trade execution messages via Spring AMQP's RabbitTemplate and receives trade confirmation and price quote messages via Spring AMQP's RabbitMQ listener container in message-driven POJO style.

In the browser, the sample uses polling to display price quotes. For trades, the initial request submits the trade and a confirmation id is returned that is then used to poll for the final confirmation. I've updated the sample to take advantage of the Spring 3.2 Servlet 3 async support. The master branch has the code before and the spring-mvc-async branch has the code after the change. The images below show the effect on the frequency of price quote requests (using the Chrome developer tools):

Before the change: traditional polling

After the change: long poll

As you can see with regular polling new requests are sent very frequently (milliseconds apart) while with long polling, requests can be 5, 10, 20, or more seconds apart -- a significant reduction in the total number of requests without the loss of latency, i.e. the amount of time before a new price quote appears in the browser.

Getting Quotes

So what changes were required? From a client perspective traditional polling and long polling are indistinguishable so the HTML and JavaScript did not change. From a server perspective requests must be held up until new quotes arrive. This is how the controller processes a request for quotes:



// Class field
private Map<String, DeferredResult> suspendedTradeRequests = new ConcurrentHashMap<String, DeferredResult>();

...

@RequestMapping("/quotes")
@ResponseBody
public DeferredResult<List<Quote>> quotes(@RequestParam(required = false) Long timestamp) {

  final DeferredResult<List<Quote>> result = new DeferredResult<List<Quote>>(null, Collections.emptyList());
  this.quoteRequests.put(result, timestamp);

  result.onCompletion(new Runnable() {
    public void run() {
      quoteRequests…

Spring Mobile 1.0.0 Released

Releases | Roy Clarkson | May 14, 2012 | ...

Dear Spring Community,

We are pleased to announce the general availability of Spring Mobile 1.0!

Spring Mobile provides extensions to Spring MVC that aid in the development of cross-platform mobile web applications.

This GA release includes minor fixes and changes since the RC2 release. See the changelog and reference manual for more information.

To retrieve the software, download the release distribution, or add the maven artifacts to your project. Sample apps are available at github.com/SpringSource/spring-mobile-samples

We want to thank Scott Rossillo, Tristan Burch, Craig Walls, and Keith Donald for their contributions to this GA release, and we look forward to working with them and the rest of the Spring community on future releases. If you are building a mobile web app, we encourage you try out Spring Mobile 1.0 and collaborate with us on the next iteration of the project.

Video: More Practical Tips and Tricks with Spring Integration

News | Adam Fitzgerald | May 11, 2012 | ...

This video provides a follow-up session to Oleg Zhurakousky's successful Spring Integration Tips and Tricks webinar exploring deeper and more complex patterns for integration. The questions for this session came out of the actual customer engagements as well as the questions that are most frequently asked on the Spring Integration forums. In this edition of "Practical Tips-and-Tricks" Oleg covers the advanced topics of enterprise integration such as advanced aggregation and resequencing, asynchronous message flows, message ID customizations, content enrichment and advanced message routing and more. This video is based on a refined version of Oleg's very successful talk delivered at SpringOne 2GX 2011.

To review basics of messaging and Spring Integration watch this Message Driven Architecture video by Mark Fisher and watch the previous video in this series: Spring Integration Tips and Tricks.

Be sure to thumbs up the presentation if you find it useful and subscribe to the SpringSourceDev channel to see other recordings and screencasts.

Spring MVC 3.2 Preview: Making a Controller Method Asynchronous

Engineering | Rossen Stoyanchev | May 10, 2012 | ...

Last updated on November 5th, 2012 (Spring MVC 3.2 RC1)

In previous posts I introduced the Servlet 3 based async capability in Spring MVC 3.2 and discussed techniques for real-time updates. In this post I'll go into more technical details and discuss how asynchronous processing fits into the Spring MVC request lifecycle.

As a quick reminder, you can make any existing controller method asynchronous by changing it to return a Callable. For example a controller method that returns a view name, can return Callable<String> instead. An @ResponseBody that returns an object called Person can return Callable<Person> instead. And the same is true for any other controller return value type.

A central idea is that all of what you already know about how a controller method works remains unchanged as much as possible except that the remaining processing will occur in another thread. When it comes to asynchronous execution it's important to keep things simple. As you'll see even with this seemingly simple programming model change, there is quite a bit to consider.

The spring-mvc-showcase has been updated for Spring MVC 3.2. Have a look at CallableController. Method annotations like @ResponseBody and @ResponseStatus apply to the return value from the Callable as well, as you might expect. Exceptions raised from a Callable are handled as if they were raised by the controller, in this case with an @ExceptionHandler method. And so on.

If you execute one of the CallableController methods through the "Async Requests" tab in the browser, you should see output similar to the one below:

08:25:15 [http-bio-8080-exec-10] DispatcherServlet - DispatcherServlet with name 'appServlet' processing GET request for [...]
08:25:15 [http-bio-8080-exec-10] RequestMappingHandlerMapping - Looking up handler method for path /async/callable/view
08:25:15 [http-bio-8080-exec-10] RequestMappingHandlerMapping - Returning handler method [...]
08:25:15 [http-bio-8080-exec-10] WebAsyncManager - Concurrent handling starting for GET [...]
08:25:15 [http-bio-8080-exec-10] DispatcherServlet - Leaving response open for concurrent…

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