In this article, Josh Long will look at the latest Spring projects for the Spring IO platform

2013 has been a banner year for Spring! In April, we on the Spring team joined the Pivotal initiative, and we’re not alone! The new company is composed of Spring (including the Grails, RabbitMQ, Tomcat, Redis, and GemFire teams), Cloud Foundry (the open source PaaS (platform-as-a-service), and Greenplum (who have leadership in smart data warehousing and Hadoop, among other things).

Today, developers are being asked to handle more challenges then ever, and to do so more quickly. It can be a dizzying task to keep up with today’s technologies, especially given the ongoing innovation surrounding big-data, cloud computing, mobile, and web development, but Spring (and Pivotal (@gopivotal) has your back! Spring is part of a larger platform that we’re calling Spring IO.

In this article we’ll look at the latest and greatest Spring projects and their place in the Spring IO platform.

NoSQL, NewSQL, and NOSQL with Spring Data
The Spring Data projects embrace the new breed of so-called NoSQL, NewSQL, or NOSQL (not-only-SQL) solutions. Spring Data is not one API to rule them all, instead it is an umbrella project with specific APIs for popular “database” technologies like Redis, MongoDB, and Neo4J. In addition, there are many third party bindings for projects like ElasticSearch, SOLR, CouchDB, and Riak.

One concept common to many Spring Data modules, including the Spring Data JPA module, is the notion of a repository. A Spring Data repository, named for the repository design pattern, is an interface that Spring Data implements at runtime using convention-over-configuration to dynamically build the implementation, typically by interacting with some backend resource. Here’s a Spring Data JPA repository that I can inject and use anywhere in my code. I’ve added in comments a rough example of the query that each method generates.

@RestResource (path = “users”, rel = “users”) // automatically exposes a REST endpoint at /users/*
public interface UserRepository extends PagingAndSortingRepository {

// select * from users where username = ?
User findByUsername(@Param(“username”) String username);

// select * from users where firstName =? or lastName = ? or username = ?
List findUsersByFirstNameOrLastNameOrUsername(
    @Param(“firstName”) String firstName,
    @Param(“lastName”) String lastName,
    @Param(“username”) String username);

In this case I’ve used Spring Data JPA’s repository support, but I could’ve just as easily used Spring Data MongoDB’s, Spring Data Neo4j’s or Spring Data GemFire’s and those query methods would’ve instead mapped to those backend databases, instead of SQL. Note, also, the@RestResource annotation provided by Spring Data REST. This annotation transparently maps the repository to a RESTful service endpoint and works in conjunction with Spring MVC. That’s not to shabby for a single Java interface!

Read the Full Article Here.