The Spring Blog

News and Events

The Common Service Locator library

The CommonServiceLocator project was released this week on CodePlex with the general idea of providing an IoC container agnostic API for resolving dependencies using Service Location. Erich Eichinger from SpringSource contributed the Spring.NET implementation, thanks Erich!

Here is the API so you get the basic idea
public interface IServiceLocator : System.IServiceProvider {

object GetInstance(Type serviceType);
object GetInstance(Type serviceType, string key);
IEnumerable GetAllInstances(Type serviceType);
TService GetInstance ();
TService GetInstance (string key);
IEnumerable GetAllInstances ();

One of the fears I had in participating in this project was that it would promote the approach of Service Location/Dependency Pull over Dependency Injection. I’m glad to see blogs entries like Ayende’s and (more forcefully) Daniel Cuzzulino’s that put this library in the proper perspective.

The intention of this library is primarily for low-level integration between application frameworks. It has a role in business code only as a last resort when you need to ask a container to provide you with a new object instance at runtime that takes advantage of additional container services such as configuration via dependency injection or applying AOP advice. WebForms, WCF Services, and ‘traditional’ server-side objects created at application startup (DAOs, etc) can all be configured non-invasively using dependency injection.

If you find yourself frequently using the service locator approach in your application you should consider refactoring the code to use dependency injection. Not only will you remove an extraneous dependency, always a good thing, but you will get the additional benefit of making your class easier to unit test in isolation of the container as its dependencies will be exposed via standard properties and constructors.

One alternative approach, used in Spring Java but not yet implemented in Spring.NET is to provide a ServiceLocatorFactoryObject, described by my colleague Alef Arendsen here. This allows you to write your own simple service locator interface, for example.

public interface ProcessCreator {
Process CreateProcess(string processId);

The container would provide the implementation dynamically at runtime. You can then use dependency injection to configure your class with a reference to ProcessCreator. The only service locator ‘API’ provided with ServiceLocatorFactoryObject are of methods with the signatures IMyService GetService() or IMyService GetService(string id) but others could be envisioned.


Spring Security 2.0.4 Released

We're pleased to an announce the release of Spring Security 2.0.4.

This release contains minor bugfixes and improvements. There are also some changes to the security namespace so you should update to the new 2.0.4 schema file if necessary. There are also some documentation updates, including two new reference appendices in the manual - one describing the database schema used within Spring Security and one describing the elements and attributes in the namespace and how they map to underlying implementation classes.


SpringSource dm Server 1.0.0 reaches GA

You may have noticed that SpringSource announced the general availability of the SpringSource dm Server™ today. The dm Server is part of the SpringSource Application Platform. Since this is the first time out for the dm Server, I want to make a couple of short comments about the product.

We believe that the dm Server overall will change the way enterprise Java software is developed and deployed. In particular, the dm Server is designed from the ground up, to be lightweight (the dm Kernel has a footprint of about 3 megabytes), flexible, and fast. It is also designed to facilitate modular development and simplify dependency management. On the operational side, the dm Server is designed to provision, deploy, start and stop services at runtime. As services are increasingly deployed in grid, virtualized, and cloud environments, the ability to initially provision the kernel only and load additional services on the fly in response to service requests will become a significant differentiator.


SpringSource Seminar Day Linz in Review

A brief pictorial review of the SpringSource Seminar Day in Linz, having happened on September 8th, 2008, at the Bergschloessl Linz… More than 150 people were listening to a six-pack of presentations about what’s new and upcoming at SpringSource. The “Story of Spring” keynote by Rod Johnson and Adrian Colyer was a great start into a day full of information: about the SpringSource Application Platform, the SpringSource Tool Suite, Spring 3.0, etc. (See the original blog announcement for details on the agenda.)


SpringSource (and other top vendors) leading the OSGi charge

In a press release made available by the OSGi Alliance yesterday, several leading vendors including SpringSource, IBM, Oracle, RedHat, Sun, SAP, ProSyst, and Paremus joined forces in their support of OSGi as the foundation for next generation server platforms.

To highlight some of the key points:

Craig Hayman, VP IBM WebSphere said

[IBM] has been shipping WebSphere Application Server built on OSGi since 2006. As a result, IBM clients benefit from a modular platform built with proven components and the ability to automatically use only the components required by their application.

SpringSource dm Server 1.0 RC2 Released

I’m happy to announce the availability of RC2 of the SpringSource dm Server, previously known as the SpringSource Application Platform. This release is feature complete and barring any serious issues will become 1.0 GA in two weeks time.

This release fixes a few critical bugs, upgrades to Tomcat 6.0.18 and updates all code, documentation and supporting materials to reflect the new name.

Due to the renaming of the product, PlatformOsgiBundleXmlWebApplicationContext has been renamed to ServerOsgiBundleXmlWebApplicationContext and moved from the package to the package. Thus, if you are setting the contextClass for Spring MVC’s ContextLoaderListener or DispatcherServlet in web.xml in a Shared Services WAR, be sure to change the fully qualified path to


Early draft of OSGi Service Platform Release 4.2 specification now available

The OSGi Alliance have posted an early draft of release 4.2 of the Service Platform specification.  SpringSource employees are active members of both the Core Platform Expert Group (CPEG) and the Enterprise Expert Group (EEG) within the Alliance. My personal involvement has been largely with the EEG, and particularly with RFC 124 “A Component Model for OSGi”.

RFC 124 is a standardization of the core ideas behind Spring Dynamic Modules. If you look at the configuration schema, you’ll see that it very closely resembles the “osgi” namespace provided by Spring Dynamic Modules (DM).  RFC 124 takes everything that we have learnt over the last couple of years developing Spring DM and combines this with some key insights from other members of the core and enterprise expert groups to produce a specification that is both based on proven real world experience and also closely integrated with the OSGi Service Platform itself. Many thanks go to the Spring DM development team :- Costin Leau, Hal Hildebrand of Oracle, and Andy Piper of BEA (now Oracle) for all their hard work in helping to develop and test Spring DM, and then to help us take the model forward as the basis for standardization in the OSGi Service Platform.


Who is the Chief of the Apache projects?

The answer is the Apache Software Foundation (ASF), a non-profit, meritocracy-based organization made up of individuals (not companies) who contribute code, bug fixes, answers to user questions, their time, and sometimes even their money to ensure that the software they are delivering addresses real-world requirements, along with being robust, secure, and widely adopted.

ZDNet’s Dana Blankenhorn’s response to Dave Rosenberg’s blog regarding companies selling support for technologies they don’t own or contribute to inspired me to set some things straight about Apache projects and companies that “support�? them. SpringSource which, through its acquisition of Covalent, is a significant contributor to a number of Apache projects. I agree with Dave that vendors who are attempting to monetize open source projects by merely selling “support�? around those technologies, while not contributing to the software, are little more than parasites. Not only do these companies not contribute to the projects, but their lack of involvement results in inferior support, which harms users and, ultimately, the reputation and acceptance of the projects.


Spring Integration 1.0 Milestone 6 Released

Dear Spring community,
We are pleased to announce that Spring Integration 1.0.0.M6 is now available.
Download | Reference Documentation | JavaDoc

To see a list of features added and issues resolved since Milestone 5, view the changelog. For more information, visit the Spring Integration Home or join the discussion at the Spring Integration Forum. Community feedback is more important than ever as we approach the Release Candidate.

Mark Fisher
Spring Integration Lead


Amsterdam Java Meetup - September 12th

Now that the holiday season (at in the Netherlands that is) has almost ended, I thought it would be time for another Amsterdam Java Meetup. So, we reserved the good-old Jaren in the Nieuwe Doelenstraat again, for having a few (paid-for) drinks with fellow Java developers and everybody else that wants to join in.

We’re doing this in the same week as the Core AOP course, held in Amsterdam, which is quite convenient for me, since now I’m sure I will be in town as opposed to some of the other meetups where I couldn’t be present myself.