Category Archives: Conferences

S2G Conference, London May 31st – Notes on Spring Integration, Josh Long

Tough lecture after lunch, Josh covered the Spring Integration project. Based on Gregor Hophe’s book, it has a lot of similarities with the Apache Camel Project. I wanted to take more notes but my laptop started shedding battery life and I really wanted it for the next lecture.

I did want to ask why someone should use this project rather than Apache Camel but it seemed a negative question and I didn’t want to ask one of those.

S2G Conference, London May 31st – Notes on Spring MVC 3.1, Rossen Stoyanchev

Java based Web MVC Configuration
Contimizable @MVC
URI templates variable
Serverside testing

Java based Web Annotation Namespace
Java based config allows you to create  a class, annotate it with a @configuration to indicates that this is going to created bean instances. This allows you to keep your config with your code
Most Spring MVC is java based already so why not enhance it. Servlet 3.0 spec further reduces the xml load and xml is not transparent anyway.

Enables declarations of HandlerMapping, Converters, Resolvers, MessageSources, Multiplart

public class WebCnfig {


Also have the ability to exclude configuration classes that have already been discovered

//WebMvcConfiguration example class already exists but also extending WebMvcConfigurationAdaptor allows selective overrides for easier start up.

This does not exclude xml based config. It just means that Java is loaded first and then xml can be loaded secondarily

An example of this os the  GreenHouse application – the class.

Nice use of the Environment object which plays nicely with the profiles. The properties are are enabled with the code

Cusomtizable MVC
The chance to annotation based MVC was a big change. More flexible mapping, better information on interception

New classes. HandlerMethod not just for @RequestMapping but also @InitBinder, @ModelAttribute and @ExceptionHandler. These underlying infrastructure classes have numerous advantages. THe ability to know the handler method that is going to be invoked, different controller has handler different HTTP methods on the same URL

Fully customisable processing pf all method arguments – HandlerMethodArgumentResolver
Same of all return types

Transition from 3.0 should be seeless since all the current classes will still exist but the new classes are the future and are recommended

Handler Method Interception
Pr/post bind and pre/post validation hooks
COntrollerethod name conventions for default views, e.g. = account/show

URI Template Variable
Path variables can be automatically added to the model
Redirect supports path variables, e.g. RequestMapping /events/{year}/{month} has a redirect of “redirect:/return/events/{year}”{month}
It also offers databinding on none model parameters in the request mapping decorated methods

Matching MediaTypes
In 3.0 you used the headers attribute in the @RequestMapping annotation. In 3.1 the consumers and produces similar to JAX-RS. The consumers/produces offers the benefits of a proper return value on mismatches like 415 on a bad request type or 406 NOT_ACCEPTABLE

Serverside Test Support.
Testing a controller properly. Unit test only does the class and not the framework features. This normally requires an integration test that requires an in-memory  servlet  (JWebUnit)
We want to verifier framework features like binding errors or redirects and forwards or even view names
This is work in progress and will be in the spring-test project when it is ready

S2G Conference, London May 31st – Notes on Spring 3.1, Jurgen Holler (Spring Framework Project Lead)

Spring 3.1 Jurgen Holler (Spring Framework Project Lead)

Themes and Trends

Background and Current Trends
Again a mention of the cloud within the principle of war files becoming dominant
Given that most cloud stacks are simple arrangements of best of breed  – what happens with the application servers? Only Glassfish supports all, JBoss 6 and Websphere 8 only support the Java EE Profile.
Tomcat 7 is the first server that SS test against. He expects all Clouds to offer Tomcat 7 as a default fairly soon.

From a spring perspective, Spring is DI, AOP and Portable Service Abstractions (Persistence, Scheduling, Transaction Strategies) around simple objects.

Spring 3.0 Review
Annotated component model, including JSR-330 support
Spring EL
REST support
Portlet 2.0 support
Declarative Model Validation (JSR-303 Bean Validation)
JPA 2.0

Spring 3.1 Key Themes
Environment Profile for Bean definitions
Java-based application configuration
Cache abstraction and declarative caching (fully fledged not just some EHCache beans)
Support for Servlet 3.0
Customizable @MVC processing (this was very popular in Spring 3.0)
Conversation Management

Environment Profile for Bean definitions
A core api then provides an environment type
It is an SPI
PropertyPlaceholderConfigurer will now delegate
Profiles activate beans depending on attribute in the beans element e.g.

<beans profile=”production”>

<beans profile=”embedded”>


or @Profile on configuration classes or even on individual classes

Activated by or something else like JNDI or environment variable or even programmatic. IDeally this should be done outside the deployment unit. This works well with Continuous Delivery

The Application Configuration model is very elegant. Able to offer almost as much power as the xml, including the tx name space. Builder classes are used to the session Factory for Hibernate for example. Builders are starting to crop up in Spring 3.1 in JPA for example to set up complex object in Java

SS are still investing in the xml namespace. Shortcut for constructor args, c:namespace. Using the constructor names gets around the issues for reflection  (constructors have an index and a type) and other runtime issues. Allows final fields so always nice. But this uses ASM to read the debug symbols so how fragile is it even if it is expressive?

Cache Abstraction
Very important with the rise of distributed caching – (cloud again!)
Before now, only had EhCache support
CA Allows you to integrate the likes of EhCache, Gemfire and Coherence.
The framework may not have specific examples since the caches are often closed source and proprietary
Setup is often on per environment bases so again plays well with the Environment Profiles

Declarative caching
Not code, just annotations on methods, concise and readable
Caching bypass @Cacheable(condition=”name.length < 10″),
Strategies are customisable. Simple but powerful for the 80% that is this simple. More complex interactions can be done via the AbstractCacheManager which you can just inject
Also a cache namespace in xml.
Need to create a cacheManager, just like Tx namespace. If you don’t declare one then annotations are just bypassed so nice in dev.
CacheManager SPI

Servlet 3.0
such as Tomcat 7.0 and Glassfish 3
XML free spec (if you want)
Async request processing (Spring 3.1 does not support this yet)
File upload support as standard but how much of  a pain point is this?
WebApplicationInitializer allows programmatic startup of the web app. I think that some best practise needs to spring up around this. How many do you want? What is the security implications of web.xml fragments, especially in 3rd party libs.
JPA requires an xml config so that may be the only one your application needs
Jurgen makes a good point that xml config is not necessarily bad. It’s readable and has great support in modern iDEs but now the choice is yours and not made for your by the framework.

Configurable MVC processing
REST support is improved
Arbitary mappings better supported

Conversation Sessions
more flexible lifecycle and storage options
Seems to be more around the integration/management rather than a new scope: isolation between tabs and windows where they share HttpSessions but this is a flag rather than anything more sophisticated.

Spring 3.1 M2 is going to be released this week. No M3 , RC is next

Spring 3.2 planed for Spring 3.2. Direct follow up for 3.1 but based around Java 7 (GA release Q3 2011). JDBC 4.1 support and support for fork-join framework. Also JSF 2.2 and JPA 2.1 updates and maybe Hibernate and Quartz updates

Java 7 offers some new concurrent programming APIs (like java.util.concurrent.ForkJoinPools) that offer really good functionality

London Java Community 2nd Unconference

There were some great talks at the 2nd London Java Community Unconference, organised in association with the Apache Software Foundation. This was my first unconference (what is an unconference? It is defined on Wikipedia as a “facilitated, participant-driven conference centered around a theme or purpose”) and the topics ranged across core Java, languages other than Java on the JVM, upcoming releases of popular products and much more.

I attended Mark Thomas’ Tomcat 7 talk. It’s always nice when you have a talk like this given by the release manager and main committer to that project – an old version of his presentation can be found at Richard Paul gave a very useful talk on “Agile Acceptance Testing: Cucumber, Groovy and Selenium2” (his slides are available at and Richard Donovan added some interesting points on Risk Based Testing. This topic was of particular interest to me at the moment as large Agile projects (>20 devs) seem to require more QA than smaller ones. This may just be a reflection of the complexity of the domain and the project but while I doubt that there is a silver bullet for this, ideas like BDD and RBT can definitely help. The discussion led by Wolf Schlegal on “Going Functional in the JVM” showed that there is a lot of interest in this area but also highlighted that not too many people have actually used functional programming languages in anger and have managed to get them into production environments.

After a short lunch break a round of lightning talks (5 mins – no more) covered Kanban, the benefit of fast feedback with open source, a personal experience of how unit tests can be useful in making developers think about their code before they write it, running a ‘dojo’ event, XSS and OSGI analysis tools in Apache Aries. Barry Cranford was there as the friendly face of recruitment and took an open session of “Ask your recruiter anything”. I’ll admit that I sloped off at this time due to other commitments but I had a great day.

It was my first unconference and while one might think that you could potentially struggle for topics, the reality was that there were more than enough talks to fill the rooms. In fact, the organisers did a great job in separating out the topic threads so that there was minimal overlap or clashes of related talks and I walked away with a lot to think about. Thanks to all the organisers and speakers for a great day.