Rossen Stoyanchev

Rossen Stoyanchev

Recent Blog posts by Rossen Stoyanchev

Spring 3.1 M2: Spring MVC Enhancements

Engineering | June 13, 2011 | ...

This post focuses on what's new for Spring MVC in Spring 3.1 M2. Here are the topics:

  • Code-based equivalent for the MVC namespace.
  • Customizable @MVC processing.
  • Programming model improvements.

A brief reminder that the features discussed here are in action at the Greenhouse project.

Code-based Configuration For Spring MVC

As Chris pointed out in his blog post last Friday, XML namespaces cut down configuration dramatically but also reduce transparency and sometimes flexibility. This holds true for the MVC namespace, which supports a number of customizations but not everything that's available. That means you are either able to use it or otherwise leave it. We believe code-based configuration has a solution for that and a path from simple to advanced.

Let's begin with this simple, familiar snippet:


<mvc:annotation-driven />

Although not required for using annotated controllers, <mvc:annotation-driven> does a number of useful things -- it detects the presence of a JSR-303 (Bean Validation) implementation and configures data binding with it, it adds a JSON message converter if Jackson JSON library is available, and a few other things that can save quite a bit of configuration.

Now let's match that with code-based configuration:


@Configuration
@EnableWebMvc
public class WebConfig {
}

Here @EnableWebMvc imports an @Configuration class that matches the goodness of <mvc:annotation-driven>. As simple as that.

The next step is to use an attribute in <mvc:annotation-driven> perhaps to provide a FormattingConversionService, or to add a sub-element perhaps configuring message converters, or to use other MVC namespace elements like <mvc:interceptors>, <mvc:resources>, etc.

Let's see how to do all of that in code-based configuration:


@Configuration
@EnableWebMvc
public class WebConfig extends WebMvcConfigurerAdapter {

    @Override
    public void addFormatters(FormatterRegistry registry) {
        // register converters and formatters...
    }

    @Override
    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
        // add message converters...
    }

    @Override
    public void configureInterceptors(InterceptorConfigurer configurer) {
        configurer.addInterceptor(new…

Spring Web Flow 2.3.0 Released

Releases | March 01, 2011 | ...

Spring Web Flow 2.3 is now available for download. You can review what's new in the reference documentation, see the complete changelog, or download the release.

A few of the highlights include:

  • Launching a flow in a page embedded mode.
  • JSR-303 bean validation support.
  • Propagation of a flow-managed persistence context to sub-flows.
  • Support for partial rendering with Portlet resource requests.

Spring 3.1 M1: MVC Namespace Enhancements and @Configuration

Engineering | February 21, 2011 | ...

In this 5th post of the series describing Spring 3.1 M1 features, I will focus on web applications. In the first half I'll discuss enhancements to the MVC XML namespace. Then I'll show how to create the equivalent of the MVC namespace with all Java configuration. At the end I mention some of the Servlet 3.0 related configuration changes you can expect in 3.1 M2.

MVC Namespace Improvements

Spring MVC 3.0 provided a custom MVC namespace. The centerpiece of the namespace -- the <mvc:annotation-driven> element, configured everything required to process requests with annotated controller methods. More importantly though it…

Spring Web Flow 2.2.0 Released

News | October 12, 2010 | ...

I'm pleased to announce the availability of Spring Web Flow 2.2:

  • JSF 2 support
  • Spring Travel sample application built on JSF 2 and PrimeFaces components
  • Facelets tag library for Spring Security
  • dojo 1.5 and dojox
  • Two spring-js artifacts (spring-js and spring-js-resources)
  • Portlet 2.0 and JSF 1.2 support

Please check out the updated documentation and samples for details.

Download | What's New | Changelog

Spring Web Flow 2.2.0.RC1 is available

Releases | September 23, 2010 | ...

Building on the JSF 2 support in M1 this release features:

  • JSF 2 Spring Travel sample built with PrimeFaces components.
  • A Facelets tag library for the popular Spring Security framework including an <authorize> tag and several EL functions.
  • A working Portlet 2.0 and JSF 1.2 sample that builds on Web Flow's own Portlet support (i.e. without any Portlet Bridge for JSF dependencies).
  • Spring JavaScript jar split into two artifacts: one for Java and one for non-Java resources (css, .js).
  • Upgarde to dojo 1.5 and inclusion of dojox in the bundled custom build.

Full Changelog | Download

Note that documentation is not yet updated. Please use the sample code provided with the distribution and the comments in the appropriate JIRA tickets.

Spring Web Flow 2.2.0.M1 Released

Engineering | August 05, 2010 | ...

I'm pleased to announce the first milestone of Spring Web Flow 2.2 is now available for download. The release is also available through the Maven milestone repository at http://maven.springframework.org/milestone. As with Spring Web Flow 2.1, this release requires JDK 1.5, Spring 3 and Spring Security 3.

The main focus of the release is to address the needs of JSF users by extending the list of supported JSF 2 features. Not long ago Web Flow 2.1 made it possible to use JSF 2 dependencies without the need for the separate Sun Facelets jar that is commonly used with JSF 1.2 today.

In Spring Web…

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