Spring 3.1 M1: Introducing @Profile

Engineering | Chris Beams | February 14, 2011 | ...


In my earlier post announcing Spring 3.1 M1, I discussed the new bean definition profiles feature as applied when using Spring <beans/> XML to configure the container. Today we'll introduce the new @Profile annotation and see how this same feature can be applied when using @Configuration classes instead of XML. Along the way we'll cover some best practices for designing @Configuration classes.

Recall @Configuration

For those unfamiliar with @Configuration classes, you can think of them as a pure-Java equivalent to Spring <beans/> XML files. We've blogged about this featureset before, and the reference documentation covers it well. You may want to revisit those resources if you need an…

SpringOne 2GX 2010 Tech Talk: Configuration Enhancements in Spring 3.1

News | Adam Fitzgerald | February 14, 2011 | ...

SpringOne 2GX 2010 Tech Talk: Configuration Enhancements in Spring 3.1
After last week's release of Spring 3.1, there is some great material to help you get up to speed with the new enhancements. InfoQ has published another talk from SpringOne 2GX 2010, this one covers the Configuration Enhancements in Spring 3.1. Chris Beams covers unified property management, bean definition profiles, nested elements, c: namespace, Grails BeanBuilder integration.

Also last week Juergen Hoeller gave a webinar on the Spring 3.1 milestone release. In case you can were not able to attend in person, a full recording of the webinar has now been posted so you can get all of the details from the source!

Also don't forget to read Chris's recent blog post about Bean Definition Profiles. This is the first in a short series that will be covering the details of the new release.

Spring Framework 3.1 M1 released

Engineering | Chris Beams | February 11, 2011 | ...

The first milestone release of Spring 3.1 has just been published [1], and this article kicks off a series of posts where I and other team members will walk through each of the major features. Even in the first milestone there's already a lot to talk about!

  • Bean definition profiles
  • Unified property management through Spring's new Environment abstraction
  • Enhancements to Java-based configuration with @Feature methods
  • Expanded MVC namespace support and a Java-based configuration equivalent
  • Streaming support and new interception model for the RestTemplate API
  • Comprehensive caching support
  • New c: XML namespace for concise configuration of constructor injection

Today I'll be covering the first item -- a new feature we call bean definition profiles. One of our most frequent requests has been to provide a mechanism in the core container that allows for registration of different beans in different environments. The word "environment" can mean different things to different users, but a typical scenario might be registering monitoring infrastructure only when deploying an application into a performance environment, or registering customized implementations of beans for customer A vs. customer B deployments. Perhaps one of the most common cases would be working against a standalone datasource in development vs looking up that same datasource from JNDI when in QA or production. Bean definition profiles represent a general-purpose way to satisfy use cases of this kind, and we'll explore the latter use case in the examples below.

Get hands-on with a sample

I've developed a small sample to accompany this post, and you might like to take a moment now to check it out (if not, don't worry; you don't need the code to read along below). Just follow the instructions on the README at https://github.com/cbeams/spring-3.1-profiles-xml. If you're not familiar with Git, the README has instructions…

Spring 3.1.0 M1 Released

Releases | Chris Beams | February 11, 2011 | ...

The first milestone of Spring 3.1 is now available from our http://maven.springframework.org/milestone Maven repository or for direct download from our community download page. This release includes new features such as:

  • Bean definition profiles
  • Enhancements to Java-based container configuration
  • Caching abstraction
  • new c: XML namespace
  • Improvements to Spring MVC
Stay tuned to the SpringSource Blog over the coming week for a series of posts covering what's new in 3.1.0.M1.

Download | Documentation | Javadoc API | Change Log | JIRA

Don't forget that Spring users can ask questions in the community forum and identify issues in JIRA as well.

Getting started with Spring Data JPA

Engineering | Oliver Drotbohm | February 10, 2011 | ...

As we have just released the first milestone of the Spring Data JPA project I’d like to give you a quick introduction into its features. As you probably know, the Spring framework provides support to build a JPA based data access layer. So what does Spring Data JPA add to this base support? To answer that question I'd like to start with the data access components for a sample domain implemented using plain JPA + Spring and point out areas that leave room for improvement. After we've done that I will refactor the implementations to use the Spring Data JPA features to address these problem…

Spring BlazeDS Integration 1.5.0.M2 Released

Releases | Jeremy Grelle | February 10, 2011 | ...

Dear Spring Community,

I'm pleased to announce that the 1.5.0.M2 milestone release of Spring BlazeDS Integration, the open source solution for building Spring-powered RIAs with Adobe Flex, is now available.

Download | Reference Documentation | JavaDocs | Changelog

Highlights of the significant new features and enhancements in this release include:

  • Support for reading and writing AMF content with RESTful Spring MVC @Controllers. This serves as a nice alternative to the direct RPC approach of the Remoting Service, reducing duplication of effort in applications that need to support multiple client types. (See the updated Test Drive for usage examples.)

  • A major refactoring of the Spring Security 3 support, resulting in easier integration of Flex apps with various Spring Security features such as Remember Me, Session Fixation Protection, and Concurrent Session Control.

  • Further evolution of the Hibernate serialization support introduced in 1.5.0.M1, including the option to use direct field mapping instead of property-based mapping.

  • Easier customization and namespace-supported configuration of framework-provided services such as the LoginCommand and MessageInterceptors.

  • Upgraded compatibility with Spring Integration 2.0.x

  • A complete revision of the Maven-based Test Drive samples, including an update across the board to use Flex 4, and a brand new sample to demonstrate the RESTful programming model.

One additional item to note is that the Flex Addon for Spring Roo is no longer part of the project distribution. Instead, version 1.0.0.M2 of the Flex Addon will be released separately in the coming weeks and will be available to Spring Roo 1.1.1 users through Roo's Addon Discovery mechanism. If you'd like to try out the nightly builds of the Flex Addon (which are necessary for compatibility with Roo 1.1 and above), I encourage you to reach out to the community for guidance.

As always, I encourage anyone interested to get involved by trying out the release and giving us feedback in the community forum and Jira, as we are fast approaching 1.5.0.RC1. We continually get great feedback from people having success with Spring BlazeDS Integration in their projects, and we look forward to hearing more about your experiences.

Jeremy Grelle
Spring Flex Lead

Spring Data Key Value (Redis + Riak) 1.0.0.M2 Released

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

Dear Spring Community,

I am pleased to announce the second milestone release of the Spring Data Key Value 1.0 project, with support for Redis and Riak, is now available!

Downloads | JavaDocs | Reference Documentation | Changelog

This release introduces several new features for both Redis and Riak, such as:

  • [Redis] Pubsub support (such as a MessageListenerContainer for message-driven POJOs)
  • [Redis] JSON and Spring Object/XML mapping serializers
  • [Redis] Full support for upcoming Redis 2.2
  • [Redis] Sorting and Pipelining functionality
  • [Riak] Asynchronous RiakTemplate
  • [Riak] Dedicated Groovy DSL for asynchronous Riak access

We look forward to your feedback on the forum or in the issue tracker.

Spring Data JPA 1.0.0.M1 released

Releases | Oliver Drotbohm | February 10, 2011 | ...

Dear Spring Community,

we are pleased to announce that the first milestone release of the Spring Data JPA project is now available! The release includes:

  • Merge of the Hades open-source library into Spring Data
  • Sophisticated support to build repositories based on Spring and JPA
  • Transparent auditing of domain class
  • Pagination support, dynamic query execution, ability to integrate custom data access code

    <name>Spring Maven Milestone Repository</name>

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

There are also two sample projects to play with on GitHub.

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

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.


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

Get the Spring newsletter

Thank you!

Get ahead

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

Learn more

Get support

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