Spring Android and Maven (Part 1)

Engineering | Roy Clarkson | December 17, 2010 | ...

We recently announced the M1 release of Spring Android, and with that release some questions have arisen around how to build an Android application utilizing the Spring Android Rest Template and Spring Android Commons Logging libraries. Google provides several methods for compiling an Android application, including SDK command line tools, and the ADT (Android Development Tools) Plugin for Eclipse. Unfortunately, neither of these methods includes integrated dependency management support.

Overview

As Java developers we have come to appreciate tools such as Maven and Gradle for managing external dependencies. While traditional Java applications run in a JVM, Android applications run on the Dalvik virtual machine.  The Dalvik VM executes files in the Dalvik Executable (.dex) format.  It runs classes compiled by a Java language compiler that have been transformed into the .dex format.  A build tool will need to support this process if it is going to be able to compile a compatible Android application with dependencies.

There are basically two options for including external libraries in your Android application. The first is to manually copy the jars into the libs directory within your project and update the classpath within Eclipse. This is the simplest solution, and the one most supported by the ADT plugin. The disadvantage is that you have to manage the dependencies manually. Alternatively, a third party plugin such as the Maven Android Plugin can be utilized to automatically include the dependencies from a Maven repository.

In this post I will walk through the process of using the Android command line tools, Maven, the Maven Android Plugin, and Android Maven artifacts to compile a sample application that utilizes the Spring Android libraries, and deploy it to the Android emulator. After you have configured Maven, it is easy to create a build, deploy it to the emulator, run tests, and package the app for deployment to the Android Market. Before running the sample code, we will first highlight the configuration settings necessary in the pom.xml. The components used in this example are listed below.

Maven Configuration

This section covers the parts of a pom.xml that are required for developing with Spring Android and the Maven Android Plugin.

Maven Android Plugin

In order to use Maven to build an Android application, you will need to configure the Maven Android Plugin within your pom.xml file. Android applications are deployed to the device as an apk file, not a jar. You must specify this in the the packaging configuration.


<packaging>apk</packaging>

To configure the Maven Android and Maven Compiler Plugins in the build task, set the sdk platform to the desired level. In this example it is set to 9, which corresponds to Android version 2.3.1. The emulator avd value is the name of the AVD (Android Virtual Device) you defined in the AVD Manager. In this case, an AVD with the name "9", but the AVD can be named whatever you like, as long as it matches the name you specified when creating the AVD. This is a basic configuration for the plugin that is needed to build and run an Android application…

Spring.NET 1.3.1 Released

Releases | sbohlen | December 14, 2010 | ...

Dear Spring Community,

We are pleased to announce that Spring .NET 1.3.1 is now available.

Download | Support | Documentation | Community

This release contains the following new major features:

  • Namespace parser for WCF integration
  • Initial ASPNET MVC 2 Integration for core DI capabilites
  • Support for DI using WCF's WebServiceHostFactory
  • Native .NET 4 compilation assemblies
  • Support for switching among multiple databases at runtime when using NHibernate
  • Support for NHibernate 3.0 GA release
  • Upgrade of Quartz.NET support to version 1.0.3
  • Upgrade of Apache.NMS.ActiveMQ support to version 1.4.1
  • Over 100 bug fixes and other improvements

Please refer to the changelog for additional details.

Spring Data - Redis Support 1.0.0.M1 Released

Releases | Costin Leau | December 13, 2010 | ...

Dear Spring Community,

I am pleased to announce the very first milestone release of the Spring Data - Redis Support 1.0 project 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 Redis modules provides integration with Redis key-value store.

Downloads | JavaDocs | Reference Documentation | Changelog

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

The features in 1.0.0 M1 include:

  • Connection package as low-level abstraction across multiple drivers
  • Configuration support for Redis Jedis and JRedis drivers/connectors
  • Exception translation to Spring's portable Data Access exception hierarchy for Redis driver exceptions
  • Generified RedisTemplate for exception translation and serialization support
  • Various serialization strategies
  • Atomic counter support classes
  • JDK Collection implementations on top of Redis

Spring Mobile 1.0.0.M2 Released

Releases | Keith Donald | December 09, 2010 | ...

Dear Spring Community,

We are pleased to announce that the second 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 defining feature of the 1.0.0.M2 release is a "site switcher" that switches mobile users to your mobile site unless they have indicated a preference for your normal site. This is useful in applications that aim to provide a separate site for mobile users.

For more details on the site switching algorithm, see the Change Log.

To see the site-switcher in action, check out the lite-showcase sample application and watch its supporting screencast:

Spring Mobile 1.0.0.M2 Screencast

This milestone is the second in an exciting road ahead. We invite you to get involved in Spring Mobile development and look forward to your feedback!

* The Spring Mobile 1.0.0.M2 screencast contains free music by the band The Smashing Pumpkins. The screencast is not affiliated with or endorsed by The Smashing Pumpkins.

Spring GemFire 1.0.0.M2 Released for Java and .NET

Releases | Costin Leau | December 08, 2010 | ...

Dear Spring Community,

We are pleased to announce the second milestone 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.

The new milestone updates include:

  • Native support for GemFire 6.5 (besides 6.0)
  • Extensive namespace support for configuring all the major GemFire components: cache, replicated, partitioned and client regions and many more
  • New configuration option for region lookup-only
  • More documentation (twice the size of the previous release)

To learn more about the project, visit the Spring GemFire homepage.

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

We look forward to your feedback!

Maven Configuration for Spring Integration

Releases | Mark Fisher | November 30, 2010 | ...

Dependencies

Add the following within the <dependencies> section of your POM:

<dependency>
   <groupId>org.springframework.integration</groupId>
   <artifactId>spring-integration-core</artifactId>
   <version>2.2.3.RELEASE</version>
</dependency>

That will make the "spring-integration-core" module available to your project (the "core" includes the Messaging API and Enterprise Integration Patterns support). If you want to use any of the adapters or support for XML, Groovy, and/or Spring Security, you can instead add one or more of the following as the "artifactId" value:

  • spring-integration-event
  • spring-integration-feed
  • spring-integration-file
  • spring-integration-ftp
  • spring-integration-groovy
  • spring-integration-http
  • spring-integration-ip
  • spring-integration-jdbc
  • spring-integration-jms
  • spring-integration-jmx
  • spring-integration-mail
  • spring-integration-rmi
  • spring-integration-security
  • spring-integration-sftp
  • spring-integration-stream
  • spring-integration-test
  • spring-integration-twitter
  • spring-integration-ws
  • spring-integration-xml
  • spring-integration-xmpp

NOTE: Any of the modules listed above will bring the "core" module in as a transitive dependency, so you do not need to include it in the POM if you are using at least one from that list. Also, some…

Spring LDAP 1.3.1 released

Releases | Ulrik Sandberg | November 30, 2010 | ...

Dear Spring Community,

We are pleased to announce that Spring LDAP version 1.3.1 has been released. This is an update release that adds a new LDIF parsing library, an Object-Directory Mapping (ODM) framework, and fixes a few problems that were in 1.3.0. Download | ChangeLog

A summary of the more important changes:

  • Added an Object-Directory Mapping (ODM) framework for annotation-based mapping between LDAP and Java objects; much like Hibernate or JPA, but for LDAP. Thanks to Paul Harvey for this contribution. (Docs)
  • Added an LDIF parsing library with an optional integration with Spring Batch. Thanks to Keith Barlow for this contribution. (Docs)
  • Added an extension to ContextMapperCallbackHandler that can provide the associated mapper with an indication that the response is different for each search result. (LDAP-185)
  • DIGEST-MD5 SASL authentication mechanism is now supported. Contributed by Marvin S. Addison. (LDAP-173)
  • AbstractTlsDirContextAuthenticationStrategy now provides a setter for customizing SSLSocketFactory used for TLS negotiation. (LDAP-180)
  • Added authentication methods that provide a possible authentication exception through an AuthenticationErrorCallback. (LDAP-192)

Get the latest Spring LDAP releases here

Ulrik Sandberg and Mattias Hellborg-Arthursson, Jayway
Spring LDAP Team

About

Spring LDAP is a Java library for simplifying LDAP operations, based on the pattern of Spring's JdbcTemplate. The framework relieves the user of common chores, such as looking up and closing contexts, looping through results, encoding/decoding values and filters, and more.

The LdapTemplate class encapsulates all the plumbing work involved in traditional LDAP programming, such as creating a DirContext, looping through NamingEnumerations, handling exceptions and cleaning up resources. This leaves the programmer to handle the important stuff - where to find data (DNs and Filters) and what do do with it (map to and from domain objects, bind, modify, unbind, etc.), in the same way that JdbcTemplate relieves the programmer of all but the actual SQL and how the data maps to the domain model.

In addition to this, Spring LDAP provides transaction support, a pooling library, an Object-Directory Mapping (ODM) framework, an LDIF parsing library with Spring Batch integration, exception translation from NamingExceptions to a mirrored unchecked Exception hierarchy, as well as several utilities for working with filters, LDAP paths and Attributes.

Spring LDAP requires J2SE 1.4 or higher to run, and works with Spring Framework 2.0.x, 2.5.x as well as 3.0.x. J2SE 1.4 or higher is required for building the release binaries from sources. For release 1.2.1, an installation of JavaCC 4.0 is also required when building from source. That is not necessary for release 1.3.x, since it uses Maven2, which handles all such dependencies behind the scenes.

Where to start

Download the distribution from the link above. The distribution contains extensive JavaDoc documentation as well as full reference documentation and a sample application illustrating different ways to use Spring LDAP.

Support

Support is available on the Spring LDAP support forum
Bug reports, enhancement requests and patches should be submitted to the JIRA issue tracker

Sources

Sources are available in the Spring Framework Subversion repository:
http://src.springframework.org/svn/spring-ldap/trunk (latest sources)
http://src.springframework.org/svn/spring-ldap/tags/spring-ldap-1.3.1.RELEASE (1.3.1 sources)

Maven Users

Artifacts for all production releases will be available from the central Maven repository. Alternatively, you can specify the SpringSource release repository:

<repositories>
    <repository>
        <id>spring-release</id>
        <url>http://maven.springframework.org/release</url>
    </repository>
</repositories>

The dependencies in 1.3.1.RELEASE are:

<dependency>
    <groupId>org.springframework.ldap</groupId>
    <artifactId>spring-ldap-core</artifactId>
    <version>1.3.1.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework.ldap</groupId>
    <artifactId>spring-ldap-core-tiger</artifactId>
    <version>1.3.1.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework.ldap</groupId>
    <artifactId>spring-ldap-odm</artifactId>
    <version>1.3.1.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework.ldap</groupId>
    <artifactId>spring-ldap-ldif-core</artifactId>
    <version>1.3.1.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework.ldap</groupId>
    <artifactId>spring-ldap-ldif-batch</artifactId>
    <version>1.3.1.RELEASE</version>
</dependency>

Release candidates and milestones are available from the Spring Source milestone repository:

<repositories>
    <repository>
        <id>spring-milestone</id>
        <url>http://maven.springframework.org/milestone</url>
    </repository>
</repositories>

Nightly snapshots are available from the Spring Source snapshot repository:

<repositories>
    <repository>
        <id>spring-snapshot</id>
        <url>http://maven.springframework.org/snapshot</url>
    </repository>
</repositories>

The dependencies for 1.3.2.CI-SNAPSHOT are:
<dependency>
    <groupId>org.springframework.ldap</groupId>
    <artifactId>spring-ldap-core</artifactId>
    <version>1.3.2.CI-SNAPSHOT</version>
</dependency>
<dependency>
    <groupId>org.springframework.ldap</groupId>
    <artifactId>spring-ldap-core-tiger</artifactId>
    <version>1.3.2.CI-SNAPSHOT</version>
</dependency>
<dependency>
    <groupId>org.springframework.ldap</groupId>
    <artifactId>spring-ldap-odm</artifactId>
    <version>1.3.2.CI-SNAPSHOT</version>
</dependency>
<dependency>
    <groupId>org.springframework.ldap</groupId>
    <artifactId>spring-ldap-ldif-core</artifactId>
    <version>1.3.2.CI-SNAPSHOT</version>
</dependency>
<dependency>
    <groupId>org.springframework.ldap</groupId>
    <artifactId>spring-ldap-ldif-batch</artifactId>
    <version>1.3.2.CI-SNAPSHOT</version>
</dependency>

New Groovy Debug Support in STS 2.5.1

Engineering | Andrew Eisenberg | November 30, 2010 | ...

We have included some big improvements to Groovy Debugging in the recent release of the SpringSource Tool Suite 2.5.1. It has always been possible to debug your Groovy applications using Eclipse's vanilla debug support for Java, but due to Groovy's language differences from Java and its metaprogramming, many debug features have not been working as well as they could.

All of the screenshots in this post were taken from a simple Grails app and so the debug features here are implicitly making use of dynamically added Groovy methods and properties.

Step Into

With the enhanced Groovy debug support, the…

vFabric Cloud Application Platform Update

Engineering | Adam Fitzgerald | November 30, 2010 | ...

vFabric
We have recently released updates for several components of the vFabric Cloud Application Platform. As Rod Johnson mentioned in the original announcement, vFabric is designed for fast delivery of next-generation applications that are instantly scalable and cloud-portable. These recent updates further enhance the integration between runtime application services and improve the performance, scalability, monitoring and manageability of modern applications.

vFabric tc Server 2.1

Updates to vFabric tc Server continue to make it the best place to build and run Spring applications: 

  • Spring Insight
    Included with tc Server 2.1, Spring Insight delivers real-time visibility into application behavior and performance for Spring applications during development and pre-production.  Deep real-time visibility into application behavior can now be persisted to view information spanning a previous time range.  Improvements to administration and navigation make it easy to operate and surface useful information more intuitively.
  • Enhanced templating
    A new built-in template mechanism simplifies the configuration of tc Server with the vFabric GemFire HTTP Session Management and Hibernate Cache Modules.  This allows vFabric GemFire to automatically launch with tc Server 2.1 – no application code changes or other manual intervention is required.

vFabric GemFire 6.5

vFabric GemFire is the distributed data management platform for modern applications offering dynamic scalability, very high performance and database-like persistence. Two new modules simplify the integration of GemFire with tc Server and Hibernate delivering sophisticated data management for modern applications. Jags Ramnarayan goes into great detail in his latest blog post but we will provide a quick overview here.

  • vFabric GemFire HTTP Session Management Module
    The vFabric GemFire HTTP Session Management Module offloads and manages HTTP session state for tc Server or Tomcat servers.   Pre-configured and automatically launching with tc Server, GemFire HTTP Session Management provides high performance and scalability.  This is particularly useful for web applications handling many requests and that need to scale-out to meet demand.
    • Decouple session management from tc Server or Tomcat Servlet/JSP container
    • Scale application server and HTTP session handling independently
    • Handle very large sessions without losing sessions
    • Easy to connect to tc Server via new template mechanism or Tomcat via minor configuration modifications
  • vFabric GemFire Hibernate Cache Module
    The vFabric GemFire Hibernate Cache Module provides fast, scalable, distributed L2 caching for Hibernate. Swapnil Bawaskar covers the details in his latest blog post.
    • Dramatically improve Hibernate performance
    • Reduce network traffic (and potential bottlenecks) to the database server
    • Gain all the enterprise class features of GemFire
    • Scalability – partition data across the entire cluster
    • Developer productivity & cloud-scale deployment

vFabric Hyperic  4.5

vFabric Hyperic is the application management and monitoring component of the vFabric Cloud Application Platform and it provides complete and continuous visibility into the entire virtualized application stack. Jennifer Hickey recently described the internal details about the Hyperic 4.5 release

Get the Spring newsletter

Thank you for your interest. Someone will get back to you shortly.

Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

Tanzu Spring Runtime 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