Spring Data REST 1.1.0.M1 Released

Releases | Jon Brisbin | March 11, 2013 | ...

The Spring Data team is happy to announce the next major step in the evolution of exporting domain objects to the web using RESTful semantics: Spring Data REST 1.1.0.M1 is now available in the SpringSource milestone repository.

Spring Data REST Home | Source on GitHub | Reference Documentation

Export domain objects to the web

Spring Data REST is a set of Spring MVC components that you can add to your own Spring MVC applications that export your Spring Data Repositories to the web using RESTful, HATEOAS semantics. It provides a consistent interaction API by exporting repositories to RESTful URLs that are configurable in a couple different ways.

Spring Data REST supports CRUD for top-level entities (those domain objects directly managed by a Spring Data Repository) by literally writing a single line of code that defines an interface that extends Spring Data's CrudRepository interface. That done, your entities then have full RESTful semantics. You can create new ones, update existing ones, and delete them using standard URLs that are, following the principles of HATEOAS, discoverable. That means the user agent accessing your Spring Data REST application doesn't need to have advance knowledge of what resources you are exporting. It can discover what entites exist and what relationships exist on those entities by successive calls to URLs provided in the JSON. These "links" are the real foundation and power of a HATEOAS REST application.

Changes from the ground up

Version 1.1 is virtually a re-write from the ground up. Not only is it easier to configure than 1.0 and better conforms to Spring MVC expections for the transition to Spring 3.2, but the biggest change in the internals of Spring Data REST is that it now supports other types of Spring Data repository implementations beyond just JPA. The HTTP semantics for CRUD and manging relationships (if the datastore supports it) remain the same no matter what backing datastore is used.

That means it's now possible to export JPA entities and MongoDB entities within the same Spring Data REST application and access those entities using a common URL structure and using the standard Spring HATEOAS Resource representation for all entities and collections. The user agent accessing those RESTful URLs does not need any special knowledge on which datastore the backing entities are managed by and, most importantly, you don't have to write any code to get that functionality!

MongoDB support

Spring Data REST 1.1 now supports exporting MongoDB CrudRepository implementations. The same HTTP semantics apply to MongoDB @Document entities as apply to JPA entities. GET, POST, PUT, DELETE are of course supported, but so is @DBRef. You can view and manage the relationship between two documents using GET, POST, PUT, and DELETE and you can export finder methods based on your @Query definitions. Please reference the spring-data-mongodb reference documentation for the full details of how the object mapping differs from JPA style mapping and how query definitions work.

Gemfire support

Spring Data REST 1.1 now supports exporting entities that use the high-performance Gemfire database to different Regions. Read the Spring Data Gemfire documentation for the full explanation of the vast configuration options and how POJO mapping in Gemfire differs from other mapping technologies.

Neo4J support is next

Spring Data REST 1.1 is now set to support Neo4J GraphRepositorys with the next version of spring-data-neo4j, version 2.3. When that's generally available (which should be around or before the general availablity of Spring Data REST 1.1 RELEASE), you will be able to access @NodeEntitys and their relationships using standard HATEOAS semantics, just like you do with the other datastores.

Add it to your existing apps

Spring Data REST is designed in such a way that you can, if you wish, create an entire application for the Spring Data REST application. It's just a standard Spring MVC webapp after all. But things get really interesting when you add Spring Data REST to your own services.

Spring HATEOAS author Oliver Gierke has created an example application that demonstrates the use of HATEOAS principles in a modern web application. It's called spring-restbucks and is an implementation of the Restbucks application described in the Systematic Theology of REST services: REST in Practice by Jim Webber, Savas Parastatidis and Ian Robinson.

Mixin REST services

By mixing Spring Data REST with your other RESTful services, you can get a seamless integration between those domain objects exported by Spring Data REST--objects for which you didn't have to write any code to have them exposed--and those services that don't represent an actual entity but a process. You can see an example of how a payment service might interact with domain object CRUD in the spring-restbucks application, where credit card payment processing is handled by a custom controller, while object CRUD is handled by Spring Data REST. Your custom controllers can actually piggyback onto the Spring Data REST URLs so that a consistent and simple URL structure can be maintained throughout the appliation, no matter whether the URL refers to your custom controller, a Spring Data REST JPA Repository, or any of the other supported Repository styles.

It's not exclusive

It's not an either-or with Spring Data REST. If you don't want all of your Repositories exposed to a web client, no problem! There a several different ways you can turn off functionality for Repositories. You can embed annotations into your source code or, if you don't have access or simply can't add the Spring Data REST annotations, you can use a fluent, DSL-style configuration to tell Spring Data REST how your resources should be exposed. Using Spring Data REST in your application isn't an exclusive committment to only one way of doing things. Spring Data REST is structured in a what that it will play nicely with your existing application so you can incorporate those bits of functionality from Spring Data REST you want, while still maintaining all the custom-coded services you're used to creating in Spring MVC controllers.

JSONP support moving to a filter

The JSONP support that was built into Spring Data REST 1.0 has been removed from the core framework in preference to a forthcoming general-purpose JSONP Serlvet Filter that will work much better than the way JSONP was implemented in version 1.0. When that filter is generally available, then JSONP support can be added not just to Spring Data REST, but virtually any Servlet-based REST resource.

Installation and Documentation

To get started playing with Spring Data REST, have a look at the reference documentation to get the lay of the land, so to speak, and get started playing with it in your own application by simply adding a dependency to the spring-data-rest-webmvc artifact (currently at 1.1.0.M1 in the SpringSource milestone repository) then import the Spring Data REST configuration like you see being done in the spring-restbucks application.

Learn more at CONFESS_2013

If you're planning on attending CONFESS_2013 in Vienna the first week of April, then you can hear all about Spring Data REST at my talk on exporting entities to the web.

Links

Spring Data REST Home | Source on GitHub | Reference Documentation

Spring-AMQP 1.1.4.RELEASE is now Available

Releases | Gary Russell | March 05, 2013 | ...

We are pleased to announce that Spring-AMQP 1.1.4.RELEASE is now available.

This is a minor maintenance release with fixes to a few minor issues in the AMQP Log4j Appender, as well as correcting an issue in the spring-rabbit manifest for OSGI users.

Release notes can be found here.

The project home page is here, where you can find links to documentation, downloads and APIs.

SpringOne 2GX 2012 Replays: Spring Data Repositories Deep Dive, Intro to Cascading

News | Pieter Humphrey | March 05, 2013 | ...

Spring Data Repositories – A Deep Dive

The repository abstraction layer is one of the core pieces of the Spring Data projects. It provides a consistent, interface-based programming model to allow implementing data access layers easily. The talk will start with a brief introduction and dive into best practices and implementation patterns later one.

We will conclude the session with an overview over what can actually be built on top of this generic repository abstraction and discuss integration hooks into Spring MVC and REST webservices.


About the speaker

Oliver Gierke

Oliver Gierke

Oliver Gierke is engineer at SpringSource, a division of VMware, project lead of the Spring Data JPA module and involved into other Spring Data modules (e.g. MongoDB) as well. He has been into developing enterprise applications and open source projects for over 6 years now. His working focus is centered around software architecture, Spring and persistence technologies. He is regularly speaking at German and international conferences as well as author of technology articles.

 

Introduction to Cascading

Introduction to Cascading, an application framework for Java developers to deploy robust, enterprise-grade applications on Apache Hadoop. We'll start with the simplest Cascading program possible (file copy in a distributed file system) and progress in small steps to show a Java-based social recommender system based on Twitter feeds.

Introduction to Cascading, an application framework for Java developers to deploy robust, enterprise-grade applications on Apache Hadoop. We'll start with the simplest Cascading program possible (file copy in a distributed file system) and progress in small steps to show a Java-based social recommender system based on Twitter feeds.

The objective is to show how to work with “Big Data”, starting on a laptop with sample data sets, to generate JAR-based apps which can be deployed on very large clusters.

We'll show best practices for scalable apps in Cascading, how to leverage TDD features, etc.




About the speaker

Paco Nathan

Paco Nathan

Data Scientist @ http://ConcurrentInc.com. Developer Evangelist for http://Cascading.org open source project. Expert in Hadoop, R, cloud computing, machine learning, predictive analytics, NLP. BS MathSci and CS CompSci from Stanford, 25+ yrs in tech industry. For the past several years, I've been leading Data Science teams, working with large scale MapReduce applications.



This Week in Spring - March 5th, 2013

Engineering | Josh Long | March 05, 2013 | ...

Welcome back to another installment of This Week in Spring.

We've got a lot to cover, though, so let's get to it!

  1. I'm presenting a webinar on March 14, 2013 - Multi Client Development with Spring! Join me to learn about REST, OAuth, Spring MVC, Spring Android, and much more!
  2. Join Damien Dallimore and David Turanski on a webinar as they introduce the Webinar: Extending Spring Integration for Splunk - March 28th, 2013
  3. New SpringOne2GX replays now available in HD on YouTube: Spring Data Repositories: A Deep Dive, and Intro to Cascading
  4. @SpringSource is launching a (quick) swag-giveaway campaign!
  5. Spring Security lead and ninja Rob Winch has announced the initial support for Java-based configuration in Spring Security. This is a wonderful milestone. Recently, we've seen Java-configuration alternatives to the XML DSLs offered for Spring Social, Spring Batch and - now - Spring Security. Check out the Spring Security Java-based configuration for more details.
  6. I had the unique privilege of visiting the Alibaba group in China where they're doing some amazing things with Spring. Read more in my blog, Spring at China Scale: the Alibaba group.
  7. Someone asked me this the other day and I felt like it was worthy of a mention: in your Spring MVC @Controller class handler methods, make sure that the BindingResult argument is immediately after the model or command argument, like this:
     <CODE>@RequestMapping(...) public String handleRequest( @ModelAttribute @Valid YourCustomPojo attempt, BindingResult result)</code>. 
    	 
    	 In this example, <CODE>handleRequest</Code> will validate the POJO (<CODE>YourCustomPojo</code>) - checking the POJO for JSR303-annotations and attempting to apply the constraints because the POJO is annotated with <CODE>@Valid</CODE> - and stash any errors  in the <CODE>BindingResult</code>, which it makes available if we ask for it.
    	 
    	 
    
  8. Speaking of validation using JSR 303, I found this amazing post from 2010 that I felt worth inclusion. This post introduces a custom annotation, called @SpelAssert, that works like JSR303's @ScriptAssert.
  9. Do you want to use Cloud Foundry with the continuous integration capabilities offered by CloudBees? We got you covered! The Cloud Foundry and Cloud Bees teams worked to integrate the process, and the step-by-step introduction is given here.
  10. Alvaro Videla has introduced and open-sourced his RabbitMQ simulator. The RabbitMQ simulator is an awesome visualization tool to demonstrate how RabbitMQ topologies work.
  11. Gary Russell has announced that Spring AMQP 1.1.4 is now available.
  12. The Fstyle blog has an interesting post on how to unit test Spring Security with Spring MVC test mocks.
  13. Our pal Boris Lam is back, this time with a post on how to integrate Spring Data, MongoDB and JavaServer Faces.
  14. Indika Prasad, on the Programmer's Guide blog, has put together a tutorial showing how to use Spring Security with Webdav and password encryption.
    </LI>
    <LI> The  <EM>Java J2EE SOA Key Points</EM…

Scripted 0.4 released

Engineering | Andy Clement | March 05, 2013 | ...

This week we've released version 0.4 of our JavaScript focused code editor. You can read about the background of Scripted here.

The full release notes for 0.4 are here but in this article I'll call out a few of the more interesting changes.

Tooltips


Scripted uses an inferencing engine to build an understanding of your JavaScript code. Scripted 0.3 provided some basic tooltips showing inferred information about function calls. In Scripted 0.4 this has been taken further - not only better formatting but also any jsdoc discovered is now included in the tooltips. Here you can see the tooltip that will appear when you hover over the function call:


 

Templates


Template support has been enhanced and you can now replace selections with text expansions that embed the original selection. In the first picture we have selected a function call and pressed Ctrl/Cmd+Space:

And on selecting the first template completion the editor contents become:


 

Extensibility


This version of Scripted includes a basic plugin mechanism. It is possible to write just a single .js file, drop it into the right place, and it will extend the behaviour of Scripted. The plugin API is definitely a work-in-progress but you can already achieve some useful functionality. For example we have on-save source transformer plugins that perform operations like removing white space and adding copyright messages. There is more information on the plugin system in the release notes and here in the wiki. Basically plugin development involves writing an AMD module, 'require'ing the API pieces and you are good to go.

One of the key use cases we had in mind was enabling you to write a plugin that contributed new annotations to the editor (that appear in the left hand ruler and allow styling of the editor text) . Here is a very simple plugin. This simply locates the names of fruits in your code and adds annotations for them. Perhaps not the most useful plugin but it should show what the key parts of a plugin are…

Spring at China Scale: Alibaba Group (Alipay, TaoBao, and TMall)

Engineering | Josh Long | March 04, 2013 | ...

So What Does It Take to Operate at China Scale?

Some of the companies of the Alibaba group

The challenges inherent to building enterprise applications that meet China-scale demand are unparalleled. One exemplary Chinese organization using Spring heavily to solve very unique challenges is the Alibaba group. Alibaba is itself an online auction site, like eBay in the west. The Alibaba group in turn owns a few other online service companies, like Alipay (a secure transaction processor, like PayPal in the west), TaoBao (a comparison shopping engine, like Shopzilla in the west), and TMall (an e-tailer, exposing the catalogues of merchants, like Amazon in the west).

From the InfoQ article, "on 11 November, 2012 (the Double Sticks promotion day), Tmall and Taobao witnessed 147 million user visits, purchases of 30 million people and nearly 100 million paid orders. At 0:00, more than 10 million users were concurrently online." The "double sticks promotion day" is celebrated as a sort of day to honor the single people out there. People make blind-dates, attend speed-dating events, and - somewhat like cyber monday shopping in the US - look for good deals from merchants. TaoBao reported USD $3 billion dollars for a single 24 hour period

This Week in Spring - Feb 26th, 2013

Engineering | Josh Long | February 27, 2013 | ...

Welcome to another installment of This Week in Spring! It's been an exciting two weeks for Hadoop content - Hadoop enthusiasts should check last week's post for an HD quality replay of Building Big Data Pipelines with Spring Hadoop from SpringOne 2GX 2012.

  1. Costin Leau has announced that Spring for Apache Hadoop 1.0 has gone GA!
    	This marks the end of a year in development from the time of the first betas.  There's a lot in this release. For  more information, check out  the blog. </LI>
    
    <LI>Did you guys hear about yesterday's announcement from <A href="http://www.greenplum.com/blog/topics/hadoop/introducing-pivotal-hd">about Pivotal HD, a Hadoop distribution which performs better than the competition, provides a true SQL interface, and features extra tools</a> (like an admin console and an installation, configuration and management facility) and is bundled with Spring for Apache Hadoop? 
    

    The release was in the news a lot yesterday. Here's a nice post on GigaOm, another on
    CIO , and yet another on CRN and another still on Silicon Angle

Spring for Apache Hadoop 1.0 Goes GA

Engineering | Costin Leau | February 26, 2013 | ...

We are happy to announce the first GA release (1.0) for Spring for Apache Hadoop, almost one year to the date from the release of its first milestone release. During that time we have incorporated a great deal of your feedback to drive the road-map, so thanks everyone from the community who have helped! While new features have been added over the year, the goal of Spring for Apache Hadoop remains the same, to simplify the development of Hadoop based applications.

Download it now, or view the maven artifacts here.

Simplified Programming Model & Consistency

What we have observed is that using the standard out of the box tools that come with Hadoop, you an easily end up with Hadoop applications that are poorly structured collection of command line utilities, scripts and pieces of code stiched together. The different origins of the various projects in the Hadoop ecosystem, such as Hive and Pig focusing on declarative usage or Cascading and HBase for a programmatic angle, have led to different approaches to configuration and API designs.

 

Spring for Apache Hadoop provides a consistent programming and configuration…

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