The Spring Blog

News and Events

Configuring Spring and JTA without full Java EE

Spring has rich support for transaction management through its PlatformTransactionManager interface and the hierarchy of implementations. Spring’s transaction support provides a consistent interface for the transactional semantics of numerous APIs. Broadly, transactions can be split into two categories: local transactions and global transactions. Local transactions are those that affect only one transaction resource. Most often, these resources have their own transactional APIs, even if the notion of a transaction is not explicitly surfaced. Often it’s surfaced as the concept of a session, a unit of work with demarcating APIs to tell the resource when buffered work should be committed. Global transactions are those that span one or more transactional resources, and enlist them all in a single transaction.


SpringSource Tool Suite 2.8.0.M1 Released

Dear Spring Community,

I’m pleased to announce that we just released the first milestone build for the next release of the SpringSource Tool Suite (STS).

This milestone brings mostly some updates and new features for Groovy&Grails developers, including:

  • update to tc Server Developer Edition 2.5.1

  • update to Maven 3.0.3

  • update to Mylyn 3.6.1

  • runs on JDK 1.7.0, including Spring Roo 1.1.5

  • validation and quick-fixes for constructor-arg

  • support for Grails 2.0.0.M1

  • enhanced DSL support for Grails 2.0.0.M1

  • lot of improvements for Groovy-Eclipse


Beyond the FactoryBean

I looked at what a basic FactoryBean is in my previous post. While FactoryBeans are important - and knowing what they do can help you navigate the framework more effectively - they’re by and large no longer the recommended approach to the task as of Spring 3.0 and the imminent Spring 3.1.

The whole point of a FactoryBean is to hide the construction of an object - either because it’s very complex or because it can’t simply be instantiated using the typical constructor-centric approach used by the Spring container (maybe it needs to be looked up? Maybe it needs a static registry method?) Spring has also supported the factory-method attribute in the XML format. The Java configuration approach offers a conceptually similar (in practice, the result is the same) alternative, but features a more concise, type-safe alternative.


What's a FactoryBean?

In this post, I’ll look at Spring’s org.springframework.beans.factory.FactoryBean<T> interface. The definition of this interface is:

public interface FactoryBean<T> { T getObject() throws Exception; Class<T> getObjectType(); boolean isSingleton(); }

A FactoryBean is a pattern to encapsulate interesting object construction logic in a class. It might be used, for example, to encode the construction of a complex object graph in a reusable way. Often this is used to construct complex objects that have many dependencies. It might also be used when the construction logic itself is highly volatile and depends on the configuration. A FactoryBean is also useful to help Spring construct objects that it couldn’t easily construct itself. For example, in order to inject a reference to a bean that was obtained from JNDI, the reference must first be obtained. You can use the JndiFactoryBean to obtain this reference in a consistent way. You may inject the result of a FactoryBean’s getObject() method into any other property.


Video: Adrian Colyer Discusses Enterprise Apps in 2011 and Beyond

Adrian Colyer Talks about the Future of Enterprise Development

The What's Next conference in Paris in May was one of the biggest Java events ever organized in France, energizing the vibrant French developer community. It gathered a lot of the most important Java experts from around the world to discuss at a high level the important new and emerging technologies around the Java platform.

SpringSource's Adrian Colyer had the opportunity to present to the audience and he discussed the current trends in cloud computing, covering especially PaaS with a reference at Cloud Foundry, and focusing on how PaaS impacts enterprise application design and development.


This week in Spring: August 2nd, 2011

Welcome to another edition of “This Week in Spring.” August is well underway and soon, at the end of August, VMworld 2011 will be upon us. Shortly thereafter, SpringOne will be here. It’s going to get hot and heavy very quickly, so get ready!
This week’s “This Week in Spring” has a lot of interesting content from Gordon Dickens, of Chariot Solutions. Thanks Gordon for all the good reading!

        Rod Johnson - Spring's founder and thought leader - did a keynote at TheServerSide earlier this year. 

    This post relays some of the content of that keynote, including his thoughts on
    cloud computing, SOA, and more. Check it out.

        The video of the recent webinar, "<A href="">What's New in Apache Tomcat 7</a>," is now available on the <a href="">SpringSourceDev YouTube channel</a>.   
    <LI>Luke Taylor has some great content on how to <a href="">configure Spring Security with the Scala DSL</a> he's been developing. Check it out! 
        <a href= "">Spring Data JDBC Extensions with Oracle Database Support</a> 1.0.0.M2 has been released. The new features include QueryDSL SQL module support and a fixed leak in Streams AQ. 
    <LI>  Oliver Gierke has a great post <a href= "">on how to fine tune Spring Data JPA repositories.</a>  </li> 
    <LI>This is a great post on <a href="">using CloudFoundry, and Eclipse Virgo</a> (formerly the SpringSource dm Server), together. Check it out!</LI> 
        <a href= "">Spring Social 1.0.0.RC2,</a> has just been released. Spring Social continues its steady march to GA with this latest release, including lots of new features. Check it out!
    <LI>Gordon Dickens has put together a quick walkthrough on <A href="">using tcServer with Spring Insight in SpringSource Tool Suite</a>. Very cool stuff, check it out! </LI> 
    <LI>Gordon Dickens at it again, with a great <a href="">look at using Spring Data JPA.</a>  He also has a post on using queries <a href="">in Spring Data JPA.</a> Check it out! </LI> 
    <LI>You just can't stop Gordon Dickens! This time he takes a look at the <a href="">REST support in Spring 3.0 and 3.1</a> Very concise, insightful look at the technology. Check it out! </LI> 
    <LI> Speaking of Spring MVC 3.1, I pinged Rossen Stoyanchev  and Keith Donald on the Spring web team to see what's cooking. I was really happy to learn that   flash map support will be available in Spring MVC 3.1. The flash map support is simple: it allows you to persist a value beyond a single redirect, which then expires. This has historically been useful in implementing the redirect-after-post pattern, to avoid having somebody double submit a POST submission should they try to use the back button. Faithful readers and fellow code spelunkers will know that the <a href="">GreenHouse</a> project has an implementation of this type of functionality already available. If you can't stand the (short) wait, you might consider using that until the more sophisticated, powerful offering is available, integrated into Spring MVC 3.1, directly.  </li> 
        <LI>Are you looking at Groovy? Want to learn more? There are many great resources, and entirely by accident, I've just stumbled upon another.  
           Check out <a href="">Groovy Casts.</a> 
    <LI>  This is a post that's all too common these days: what could possibly compel me to use CDI and JavaEE6? In this post,  <a href=""><em>Do I need to move from Spring to Java EE 6?</em></a>,  the answer, of course, is an ebullient, "No!" 

    This post explain’s one architect’s reasoning. Are you fleeing from CDI and JavaEE6, and moving your application to Spring? Or, simply want to reuse code from an existing CDI application, in particular CDI’s decorators? Then check out this post for an approach to reuse CDI’s decorator’s inside of Spring.
    This support is limited in scope, of course, but it’s one less thing you’d have to work on when moving to Spring. An ideal migration will take advantage of the far more robust AOP support available in Spring itself.

    <LI>  O'REILLY's just published a small getting started book for Spring, <a href=""><em>Just Spring</em>.</a> 
         I haven't had a chance to look at it, but the TOC seems promising -- it looks like a direct, 80%-centric look at using the Spring framework. Check it out.


Debugging DSLD Scripts

Not too long ago, I introduced DSL descriptors (DSLDs) for Groovy-Eclipse. DSLDs are Groovy scripts that provide rich editing support (content assist, navigation, etc.) for Groovy projects in your Eclipse workspace. Since DSLDs can only be executed inside a running Eclipse process, debugging is not as simple as firing up the Eclipse debugger and stepping through a Groovy script. In this post, I’ll describe some simple and some more complex techniques that you can use for debugging your DSLDs.

To get all of this working, you will need the latest development builds:


Video: What's New in Apache Tomcat 7

Mark Thomas discusses all the latest features that are available in Apache Tomcat 7. He talks about the specification changes (Servlet 3.0, JSP 2.2, Expression Language 2.2) some of the new features (JMX enhancements, performance improvements, new parallel deployment) and describes the upcoming plans for later releases. Check out the video or you can download the slides from the S2G Forum 2011 archive.

Be sure to thumbs up the presentation if you find it useful and subscribe to the SpringSourceDev channel to receive updates about all the latest presentation recordings and screencasts.


Spring Security Configuration with Scala

In a previous article, Behind the Spring Security Namespace, I talked about how the Spring Security namespace has been very successful in providing a simple alternative to plain Spring bean configuration, but how there is still a steep learning curve when you want to start customizing its behaviour. Behind the XML elements and attributes, various filters and helper strategies are created and wired together, but, short of reading the code which handles the XML parsing, there is no easy way of working out which classes are involved or the details of how they interact.


Spring Data JDBC Extensions with Oracle Database Support 1.0.0.M2 Released

Dear Spring Community,

We are pleased to announce that the second milestone release (1.0.0.M2) of the Spring Data JDBC Extensions 1.0 project with Oracle Database support is now available!

The new Spring Data JDBC Extensions project was created to provide additional support for vendor specific JDBC extensions as well as new approaches to working with JDBC like QueryDSL. The bulk of the support is made up of code ported from the SpringSource project “Advanced Pack for Oracle Database” that was available for support subscription customers. We are now making this code available to all Spring users and any new developments will be made in the Spring Data JDBC Extensions project.