Spring Android 1.0.0.M2 Released

Releases | Roy Clarkson | February 09, 2011 | ...

Dear Spring Community,

We are pleased to announce that the second milestone release of the Spring Android project is now available!

Spring Android supports usage of the Spring Framework in a Android environment. The 1.0.0.M2 release focuses on extending the use of RestTemplate in native Android applications:

  • We now use the HttpComponents HttpClient 4 by default for all REST calls, which is a native HTTP client on the Android platform. This replaces the use of the Commons HttpClient 3 from the first milestone.
  • We have added Object-to-XML marshaling support through the use of the Simple XML serialization library. Simple has a small footprint and is compatible with Android.
  • RSS and Atom Feeds are now supported through the Android Rome Feed Reader. Android Rome is a port of the popular Rome library that is compatible with Android.
  • Integration with the Jackson JSON Processor continues to provide first-class Object-to-JSON marshaling support.

Spring Android is available for download. If you are utilizing Maven with your Android project, simply add the following dependency:

<dependency>
    <groupId>org.springframework.android</groupId>
    <artifactId>spring-android-rest-template</artifactId>
    <version>1.0.0.M2</version>
</dependency>

<repository>
    <id>org.springframework.maven.milestone</id>
    <name>Spring Maven Milestone Repository</name>
    <url>http://maven.springframework.org/milestone</url>
</repository>

In addition to the reference guide, Roy Clarkson has authored two blog posts to help you get started developing Android applications:

A sample app with a README is available at github.com/SpringSource/spring-android-samples: git clone git://github.com/SpringSource/spring-android-samples.git

Work continues on the next Spring Android milestone, where we will we be integrating OAuth support for Android applications. If you're building native Android applications, we invite you to collaborate with us on the Spring Android project.

Spring Android and Maven (Part 2)

Engineering | Roy Clarkson | February 09, 2011 | ...

In Spring Android and Maven (Part 1), I described how to build an Android application from the command-line using Maven. In this post, I will show you how to build an Android application with Maven dependency management from the Eclipse IDE. The application will also showcase the latest features in Spring Android 1.0.0.M2, which was released this week.

Overview

The Maven Android Plugin lets you build your Android applications with Maven and benefit from dependency management. Google's Android Development Tools (ADT) plugin allows you to develop and build Android applications within the Eclipse IDE. To get Maven dependency management within Eclipse, the Maven Integration for Android Development Tools plugin is required, which integrates m2eclipse, the ADT Plugin, and the Maven Android Plugin

This week in Spring: February 8th, 2011

Engineering | Josh Long | February 08, 2011 | ...

This has been another exciting week in the Spring community. The community seems abuzz about the new Tomcat release, mobile clients, Spring Data and big data (e.g., Spring Gemfire, Redis, and of course the Spring Data projects.)

A reminder: Juergen Hoeller - lead of the core Spring framework and contributor to all of the sister Spring projects, in some fashion or another - is giving two identical webinars - one for North America and one for Europe - on the new features in Spring 3.1 in two days (February 10th)! Be sure to register for this free webinar on the next iteration of the most widely used Java framework!

This is turning out to be a record event, with incredible advance registration numbers. While there are no Spring 3.1 binaries (yet; stay tuned!), the code for the Spring project is always at your disposal, so - if you're as excited about all the new features as I am - you'll see this webinar and start playing with it long before it's…

Spring Mobile 1.0.0.M3 Released

Releases | Keith Donald | February 04, 2011 | ...

Dear Spring Community,

We are pleased to announce that the third milestone release of the Spring Mobile project is now available!

Spring Mobile provides extensions to Spring MVC that aid in the development of cross-platform mobile web applications. The 1.0.0.M3 release ships a general facility for user site preference management that can be used independently or in conjunction with the mobile site switcher. See the changelog and reference manual for all the info.

Download the release distribution or pull the artifacts from Maven using the following:

    <repository>
        <id>org.springframework.maven.milestone</id>
        <name>Spring Maven Milestone Repository</name>
        <url>http://maven.springframework.org/milestone</url>
    </repository>
&lt;dependency&gt;
    &lt;groupId&gt;org.springframework.mobile&lt;/groupId&gt;
    &lt;artifactId&gt;spring-mobile-device&lt;/artifactId&gt;
    &lt;version&gt;1.0.0.M3&lt;/version&gt;
&lt;/dependency&gt;

Get sample apps over at github.com/SpringSource/spring-mobile-samples | git clone git://github.com/SpringSource/spring-mobile-samples.git

This release marks our third iteration with early adopters in the community using Spring Mobile in their own applications. If you are building a mobile web app, we encourage you try out 1.0.0.M3 and collaborate with us on the next iteration of the project.

This week in Spring: February 1st, 2011

Engineering | Josh Long | February 02, 2011 | ...

This week's been a fascinating rush of developments in the community. Depending on where you look, the excitement is behind the newer, more cutting edge stuff like Spring Data, Gemfire, and Virgo, or it's behind the wonderful refinements to technologies like Tomcat and SpringSource Tool Suite. Either way, there's a lot to take in this week, so let's get started!

  1. SpringSource Tool Suite 2.6.0.M1 has been released. This new version features improved content-assist and quick fixes, new wizards and views for Spring MVC @RequestMapping-based applications. It also features improved content-assist performance for Groovy, and improved syntax highlighting for Groovy.
  2. Spring Data Graph - Neo4j Support 1.0.0.M2 Released. The new release has many new features, including improved indexing support - full, named index support for nodes and relationships, removal of node and relationship entities, strict type checking on entity instantiation from framework methods (according to type strategy), support for dynamic projection to arbitrary graph entities, and new updated support for Neo4j 1.2.
  3. Shekhar Gulati has posted an introduction to Spring Roo (part 1, building from source) on IBM's DeveloperWorks.
  4. Mark Thomas, a senior contributor to the Tomcat project, has written about preventing Cross-Site Scripting attacks in Tomcat 7
  5. The VMWare vFabric GemFire team has just put together a video demonstrating how to setup the GemFire's Hibernate Cache Module. The video demonstrates how to configure the module in Maven and then demonstrates its use in a Spring-DAO based implementation. Finally, the use of Spring Insight to monitor the application's performance is demonstrated. Cool video for an even cooler technology!
  6. Sebastian Pietrowski has published a good introduction to Spring Data Redis.
  7. Shekhar Gulati contributed another great post - also on Spring Data and Redis. Spring Data is the umbrella name for a slew of technologies designed to support more specialized data persistence needs. A large part of this is the deep support for many of the NoSQL data stores available today, as well as more specialized support for JDBC-based persistence.
  8. The Java Code Geeks have written up a good post on Aspect Oriented Programming with Spring AOP
  9. Jose Delgado wrote up a good post on how to configure an application to handle two databases in Spring Roo.
  10. Sivaprasadreddy Katamreddy is at it again, this time on applying Inversion of Control and Dependency Injection to method design
  11. Glyn Normington tweets that the Eclipse Virgo kernel is now running successfully for the first time on a directed graph of regions implemented using OSGi 4.3 framework hooks. Congratulations! Eclipse Virgo is the name of the new-and-improved version of what was formerly the SpringSource dm Server.
  12. David Dossot retweeted an interesting post that explores

    the Activiti BPMN 2 engine using Spring from earlier last month.

  13. With all the exciting news of Tomcat 6 and 7, it's easy to forget that Tomcat 5 is still being updated and supported. Tomcat 5.5.32 has also just been released!

Spring GemFire 1.0.0 Released for Java and .NET

Releases | Costin Leau | February 02, 2011 | ...

Dear Spring Community,

We are pleased to announce that the first GA release of the Spring GemFire 1.0 project is now available for both Java and .NET! The Spring GemFire project aims to make it easier to build Spring-powered highly scalable applications using GemFire as distributed data management platform.

Download it now: Spring GemFire for Java | Spring GemFire for .NET

This release features:

  • Declarative dependency injection style configurations for the GemFire infrastructure (such as Cache, Region, Interest, etc)
  • Extensive namespace support for configuring all the major GemFire components: cache, replicated, partitioned and client regions and many more
  • Exception translation to Spring's portable DataAccess exception hierarchy
  • Template and callback support for easy native API access
  • Transaction management support
  • Spring-backed wiring for GemFire managed objects
  • Auto-generation of non-reflection based Instantiators
  • Native support for GemFire 6.5 (besides 6.0)
  • Declarative Caching Advice (for .NET)

Through Spring GemFire, Spring users should feel right at home when interacting with GemFire while developers familiar with GemFire will see the benefits and flexibility of the Spring container, its…

Spring Data Graph - Neo4j Support 1.0.0.M2 Released

Releases | Thomas Risberg | February 01, 2011 | ...

Dear Spring Community,

I am pleased to announce that the second milestone release of the Spring Data Graph 1.0 project with Neo4j support is now available! The primary goal of the Spring Data project is to make it easier to build Spring-powered applications that use new data access technologies such as non-relational databases, map-reduce frameworks, and cloud based data services. The Graph Neo4j module provides integration with the Neo4j graph database.

Downloads | JavaDocs | Reference Documentation | Changelog

To learn more about the project, visit the Spring Neo4j Homepage.

The features in…

SpringSource Tool Suite 2.6.0.M1 Released

Releases | Christian Dupuis | January 28, 2011 | ...

Dear Spring Community,

We're pleased to announce that we just released the first milestone build for the next release of the SpringSource Tool Suite (STS).

Some highlights from this milestone build:

  • Content-Assist and Quickfixes for @Autowired and @Qualifer
  • Content-Assist in @RequestMapping for path variables
  • Updated Spring Project Wizard
  • RequestMappings from ITDs now in Spring Explorer and RequestMapping-View
  • Improved content assist performance for Groovy
  • Improved syntax highlighting for Groovy
More details on new features and bug fixes can be found in the 2.6.0.M1 New and Noteworthy document. Detailed installation instructions are also available.

As always downloads are available from the STS download page, check "Other Downloads".

Green Beans: Getting Started with Enterprise Messaging and Spring

Engineering | Josh Long | January 26, 2011 | ...

In this post, we will introduce the core concepts of messaging, as well as the rich support for various types of messaging that the Spring framework and its sister projects provide.

What is Messaging? To best explain this, I'll paraphrase the example offered by the groundbreaking Enterprise Integration Patterns book by Gregor Hohpe and Bobby Woolf (Addison Wesley, 2004). When you make a telephone call, you attempt to relay information to another party. This only works if the second party is available when you place the phone call. Because it is not always possible to answer phone calls, we use a voice-mail boxes to queue the messages. Callers leave messages in the voice-mail box and the callee is then free to retrieve the message (or, indeed, many messages) at a later point, asynchronously.

In that example, a voice-mail box sits in the middle of the two parties. It stores the message and then delivers it when the callee – the recipient – retrieves it. In the world of enterprise messaging, things work very much the same: a party sends a message to a messaging broker (also known as messaging-oriented middle-ware – MOM) and another party – when that party can – takes delivery of, or explicitly queries for, any messages from the message broker.

Here is where the analogy stops being useful. Message brokers, in contrast to voice-mail boxes, have a lot of options. Message brokers are ideally positioned to provide extra services, like routing, and to make guarantees about message delivery. Message brokers can be optimized for different use cases, for example, you can trade speed for durability. Message brokers may persist messages to an external store to ensure durability, though this is typically a configuration that can be toggled in the name of speed.

In the voice-mail box example, a message was sent by one party and then delivered to another – the communication was point-to-point. Message brokers support this, as well as another type of communication called publish-subscribe, where messages are delivered to multiple clients.

A common use of message brokers is to solve integration problems between two different systems. Data sent to a message broker is usually of a format common to both the sender and recipient of the message. The only thing that two systems need to agree on to use a message broker is the data contract. Messages typically have a message body, in which the contents of the message itself are stored, and message headers, which are key / value pairs that provide meta-data about the body of the message that can be used to aid consumers of the messages in processing the message. Message headers can be anything you like, but they typically relate to the message itself, or to the processor of the message.

Java Message Service

The Java Message Service (JMS) API specifies client interfaces for interacting with message brokers. Each message broker provides its own implementation of the API, very much like JDBC drivers do for the JDBC API. This implies that JMS clients should generally use the same version of the client as the server. There are many, many fine JMS broker implementations to choose from. One reason for this is that messaging ihas always been an important part of application development, and continues to be even more so today. JMS has been a part of the J2EE (now Java EE) specifications since 1.1. The JMS specification has been at version 1.1 for most of the last decade.

In JMS, clients use a javax.jms.ConnectionFactory to create a javax.jms.Connection. The Connection can then be used to create a javax.jms.Session. The Session represents the client interaction with the broker and allows for sending and receiving messages as well as other less obvious operations.

The most useful methods on the interface concern the creation of a message producers, and message consumers that send and receive messages to and from a javax.jms.Destination. A Destination maps the JMS concept of an "address" on a message broker. It also maps the concept of where a broker stores messages. In JMS, messages are sent to, stored in, and consumed from the same place, all represented by a javax.jms.Destination instance.

[caption id="attachment_7506" align="alignnone" width="573" caption="Above, blue elements represent producers and consumers. The orange elements represent destinations in the broker where messages are buffered. In JMS, these are either topics or queues."][/caption]

Destination is an interface and has two more specific sub-interfaces, javax.jms.Queue and javax.jms.Topic. A Queue represents a standard queue, which is a point-to-point construct as described before. A Topic provides publish-subscribe messaging and can deliver a single message to multiple recipients.

To send a message to a Destination, you must create a javax.jms.MessageProducer. The MessageProducer can then be used to send javax.jms.Messages.

JMS supports two different mechanisms to receive messages. The first way is to ask for a message, using the javax.jmx.MessageConsumer#receive() method, which returns an individual message from a Destination in a synchronous manner; the method blocks until a message is received, by default. Instead of using a MessageConsumer, clients may install a javax.jms.MessageListener by calling javax.jms.Session#setMessageListener(MessageListener). MessageListener is an interface and has only one method, public void onMessage(javax.jms.Message), which will be called whenever a javax.jms.Message is available for consumption on a Destination. A MessageListener provides asynchronous message processing: as messages arrive, they are processed.

There is quite a bit more to learn in the JMS API, but these classes and concepts will help you most in our discussion of Spring's support for JMS messaging. The first level of support is the org.springframework.jms.core.JmsTemplate, which provides simplifying methods to reduce the things we just discussed to one-liners. The JmsTemplate, requires a javax.jms.ConnectionFactory instance to do its work. JmsTemplate can do a lot of work for you. For example, to send a message, the JmsTemplate establishes a javax.jms.Session, sets up a javax.jms.MessageConsumer or javax.jms.MessageProducer, sets up all the machinery for transactions, and provide you with a reference to the current javax.jms.Session so you can create the message of your choice and send it. With all the error handling and construction logic, that's easily a savings of dozens of lines of code. Once your message has been sent, it destroys or closes most of those objects. This is standard practice in application servers (like a Java EE server) because the ConnectionFactory instances are created by the server, managed by the server, and are pooled. They cache the instances after use. Closing resources in those environments simply returns them to a pool. So, the JmsTemplate does the right thing in the standard case, assuming the ConnectionFactory caches or pools instances.

In a managed environment like an application server, you will typically need to acquire the javax.jms.ConnectionFactory from JNDI. You can use Spring to lookup that reference for you and configure a JmsTemplate. In our examples, we want to operate more loosely, so we will use the standalone ActiveMQ message broker. ActiveMQ is a popular, open-source message broker. To use it, download it, and then run the startup script appropriate to your operating system in the bin folder. In your application, you'll need the client libraries to connect for the corresponding version of ActiveMQ. At the time of this writing, the latest version of ActiveMQ was 5.4.2. If you are using Maven, add the following dependencies to your Maven pom file:



            <dependency>
                <groupId>org.apache.activemq</groupId>
                <artifactId>activemq-core</artifactId>
                <version>${activemq.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.activemq</groupId>
                <artifactId>activemq-optional</artifactId>
                <version>${activemq.version}</version>
            </dependency>

Be sure to either create a Maven property for ${activemq.version} or replace the string manually with the appropriate version. There is an activemq-all dependency out there as well, but it brings down a lot of perhaps unnecessary jars. For our application, the two dependencies above suffice.

Using Spring with JMS

Let's examine the configuration for a basic JMS application. First, let's examine the basic Spring XML configuration:



<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/200…

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