Infrastructure changes in Spring 2.1-m2

Engineering | Ben Hale | June 01, 2007 | ...

With the release of Spring 2.1-m2, some significant changes have been made to the infrastructure of the Spring distribution. Please see the announcement and changelog for the complete list of changes.

Distribution

The distribution has been trimmed from 26 JARs in 2.1-m1 to 17 JARs in 2.1-m2. Take a look at the changelog for the list of files that changed, but from the commit message, here's what's new:
  • spring-context.jar includes JMX support and core remoting support (no spring-jmx and spring-remoting jars anymore)
  • spring-orm.jar combines all ORM support packages (replaces spring-hibernate, spring-ibatis, spring-jdo, spring-jpa, and spring-toplink jars)
  • spring-web.jar contains web-related remoting and ORM classes (for proper use in J2EE EAR deployment structures)
  • renamed spring-dao.jar to spring-tx.jar, also containing the JCA support now
  • renamed spring-support.jar to spring-context-support.jar
  • renamed spring-portlet.jar to spring-webmvc-portlet.jar
  • module jar files contain module-specific "spring.handlers" and "spring.schemas" files now

Maven Artifacts

I'm also pleased to announce that starting with the 2.1-m2 release, each Spring module will now have source jars in the Maven repository. The 2.1-m2 Maven artifacts are located in a private snapshot repository at this point, but the final release will be in the main Maven repo. If you would like to start using 2.1-m2 in your Maven project add a repository location to your POM that points at https://springframework.svn.sourceforge.net/svnroot/springframework/repos/repo-snapshots/. If you are using any Maven IDE support, please also download the source jars and open any issues with them at our JIRA.

Customizing Annotation Configuration and Component Detection in Spring 2.1

Engineering | Mark Fisher | May 29, 2007 | ...

NOTE: This post has been updated as of May 31, 2007 to reflect the state of the 2.1-M2 official release

Two weeks ago I blogged about the new annotation-driven dependency injection capabilities of Spring 2.1, and I mentioned that I would follow-up with more info "later in the week". It turns out that was a bit optimistic, but the good news is the functionality has evolved quite a bit in the meantime. Therefore, to follow along with the examples here you will need to download the 2.1-M2 official release (or if you are one of the first people to read this updated entry and M2 is not yet available, you should grab at least nightly build #115 which you can download here).

The first thing I want to demonstrate is how to create an application context without using any XML. For those who have used Spring's BeanDefinitionReader implementations, this will look very familiar. Before creating the context however, we need a few "candidate" beans on the classpath. Continuing with the example from my previous blog, I have the following two interfaces:


public interface GreetingService {
	String greet(String name);
}

public interface MessageRepository {
	String getMessage(String language);
}

...and these corresponding implementations:


@Component
public class GreetingServiceImpl implements GreetingService {

	@Autowired
	private MessageRepository messageRepository;
	
	public String greet(String name) {
		Locale locale = Locale.getDefault();
		if (messageRepository == null) {
			return "Sorry, no messages";
		}
		String message = messageRepository.getMessage(locale.getDisplayLanguage());
		return message + " " + name;
	}
}

@Repository…

Conference Season Builds up to SpringOne!

Engineering | Rod Johnson | May 28, 2007 | ...

It's been a while since I had time to blog. We've been busy. We raised $10m. As Adrian has pointed out, we've been very active in product development. I've written more code myself than usual in the last couple of months. (Mainly on experimental stuff, which may or may not see the light of day, but it's fun, and sometimes I do something that turns out to be useful.) I've spent a lot of time speaking to press and analysts; we're getting huge press interest these days. Press/analyst calls can be tiring, but can also be valuable, as many of these guys are smart and ask thought-provoking questions…

New releases in the Spring Portfolio

Engineering | Adrian Colyer | May 25, 2007 | ...

Late last year we started talking about the notion of a Spring "release train". The idea behind the release train is that we put out co-ordinated releases of the products in the Spring Portfolio: tested together and working together. You can still pick and choose the pieces you need, but it will be easier to use the various products together when you want to. We're not there yet, but we're on our way.

One of the struggles for us at Interface21 has been that the demand for our support services, training, and consultancy has been so high that we've been working everyone flat out to try and meet it. This has made it hard to get the consistent and predictable product development time we need to pull off something like a release train. That's just one of the many reasons that I'm so excited about the recent announcement of the $10M investment that Benchmark Capital is making in Interface21 (press release

Spring Web Flow Java One 2007 Demo

Engineering | Keith Donald | May 18, 2007 | ...

When Sun scheduled my JavaOne 2007 session on Spring Web Flow for Friday, the last day of the conference, I wasn't sure what to expect. I was honored to have been accepted again this year, but I wondered what I would see in terms of attendance presenting on the last day of the 4-day conference.

I could not have been more pleased with how things transpired. When I checked in at speaker setup on Thursday 800 people had pre-registered for my Friday session. Fifteen minutes before my talk was to begin the room had reached that number. In the end, 1000 JavaOne attendees came to room 307-310 of…

Annotation-Driven Dependency Injection in Spring 2.1

Engineering | Mark Fisher | May 14, 2007 | ...

Spring 2.0 introduced annotation support and annotation-aware configuration options that can be leveraged by Spring users who are developing with Java 5 (or later versions):

@Transactional for demarcating and configuring transaction definitions
@Aspect (AspectJ) for defining aspects along with @Pointcut definitions and advice (@Before, @After, @Around)
@Repository for indicating a class that is operating as a repository (a.k.a. Data Access Object or DAO)
@Required for enforcing annotated bean properties are provided a value

With Spring 2.1, this theme of annotation-driven configuration has been significantly extended and will continue to evolve as we progress toward the RC1 release. In fact, it is now possible to drive Spring's dependency injection via annotations. Furthermore, Spring can discover beans that need to be configured within an application context.

This blog entry will serve as a tutorial-style introduction to the basic features in 10 easy-to-follow steps. I will follow up later in the week with information on some more advanced features and customization options. If you are interested in alternative configuration options, you should also check out the Spring Java Configuration project and this blog.

This tutorial requires at least Java 5, and Java 6 is recommended (otherwise there is a single requirement at the end of step 1).

Step 1:

Grab spring-framework-2.1-m1-with-dependencies.zip. After extracting the archive, you will find the spring.jar and spring-mock.jar in the 'dist' directory. Add them to your CLASSPATH as well as the following (paths shown are relative to the 'lib' directory of the extracted 2.1-m1 archive):

  • asm/asm-2.2.3.jar
  • asm/asm-commons-2.2.3.jar
  • aspectj/aspectjweaver.jar
  • hsqldb/hsqldb.jar
  • jakarta-commons/commons-logging.jar
  • log4j/log4j-1.2.14.jar
(NOTE: If you are not running on Java 6, you will also need to add j2ee/common-annotations.jar)

Step 2:

Provide the interfaces and classes for the example. I have tried to keep it as simple as possible yet capable of demonstrating the main functionality. I am including all of the code and configuration in a single "blog" package. I would encourage following that same guideline so that the examples work as-is; otherwise, be sure to make the necessary modifications. First, the GreetingService interface:

public interface GreetingService {
    String greet(String name);
}

Then, a simple implementation:


public class GreetingServiceImpl implements GreetingService {
    private MessageRepository messageRepository;

    public void setMessageRepository(MessageRepository messageRepository) {
        this.messageRepository = messageRepository;
    }

    public String greet(String name) {
        Locale locale = Locale.getDefault();
        String message = messageRepository.getMessage(locale.getDisplayLanguage());
        return message + " " + name;
    }
}

Since the service depends upon a MessageRepository, define…

Spring Web Flow Bean Scopes and JSF

Engineering | Ben Hale | May 08, 2007 | ...

I've recently finished up an interesting issue in Spring Web Flow. This issue (SWF-163) dealt with adding Spring 2.0 bean scoping support for Spring Web Flow's internal scopes. The implementation isn't really that interesting (the Scope interface is pretty easy to implement after all), but I wanted to mention exactly how you would use something like this in your application.

Spring 2.0 Scoping

In Spring 1.x, we had the idea of singleton and prototype bean scopes, but the notation was fixed and not especially descriptive with singleton="[true | false]". So in Spring 2.0, this notation was removed from the XSD style of configuration and now you see a notation that is more clear with scope="[singleton | prototype | ...]". Spring itself adds three more bean scopes; request, session, and globalSession which are related to web applications.

With the latest snapshots of Spring Web Flow 1.1, we now see bean scopes for the three major Web Flow scopes, flash, flow, and conversation.


<bean id="sale" class="org.springframework.webflow.samples.sellitem.Sale…

Spring Batch

Engineering | Dave Syer | May 07, 2007 | ...

Introduction

I've been working hard with a couple of clients on a new product called Spring Batch. The aim is to provide tools and applications to support bulk processing in an enterprise environment. Spring Batch is part of the Spring Portfolio with an initial release in the Spring 2.1 release train.

The original impetus to build some prototype code actually came independently from a number of Interface21 clients. This provides some useful additional detail and some constraints on the implementation so that it can be applied to the real-world problems posed by the clients. I hope that this article…

Power Combination: SCA, OSGi, and Spring

Engineering | Adrian Colyer | May 01, 2007 | ...

No, that's not my headline, it's actually the title of a white paper recently published by Open SOA collaboration. To quote from the news announcement accompanying the whitepaper:

"Based upon user feedback, the OSOA Collaboration are publishing a white paper highlighting the powerful combination of the SCA, Spring and OSGi technologies aimed to help Developers simplify the creation and composition of services critical to building applications based on an SOA approach."
The Open SOA collaboration develops the Service Collaboration Architecture (SCA) specification, with partners including BEA, IBM, IONA, Oracle, Red Hat, SAP, Siemens, Sun, Tibco, and others. So when this group starts to rally around the "powerful combination of SCA, Spring, and OSGi" it's a great endorsement of the Spring Framework and of the work that we're doing in the Spring OSGi project.

The white paper provides a short overview of SCA, OSGi and Spring, and then describes how they can be used together. Quoting from the summary:

"SCA, OSGi and Spring are all useful and powerful facilities for the Java programmer to use. In the new service-oriented world that we are entering, using SCA, OSGi and Spring together provide powerful capabilities for building service implementations from sets of simple Java Beans using few APIs, with managed dependencies, version control and dynamic update capabilities, allied to the capability to compose those implementations with other service components written in Java or in other languages and existing in a distributed network of systems using a range of communication methods.

Simplicity, flexibility, manageability, testability, reusability. A key combination for enterprise developers."

I'll be co-presenting on SCA and Spring with Mike Edwards of IBM at the JavaOne conference next week: session TS-8194, "Spring and Service Component Architecture…

Querying and Downloading from Amazon S3

Engineering | Ben Hale | April 30, 2007 | ...

In a previous post, I described how we use a custom ANT task to upload nightly snapshots from the ANT based projects in the Spring portfolio. In this post I'll describe how we use Amazon S3 to generate pages for the snapshots from each project and allow users to download the snapshots.

As I mentioned in the previous post, S3 is primarily used as a REST-ful service. This means that while I used Java for the upload portion, I was free to use other languages for the download portion. I chose to use PHP in this case because it was already available on the server I was working with, and was the…

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