Belated SpringSource S2G Forum Notes

I’ve been rather ill recently, and so this post is a bit belated, but still worth mentioning I think – if for anything else, just to refresh my memory 😉

I recently attended the SpringSource S2G Forum Series at the London Hilton. There were some good sessions being presented, and sometimes I wish I could clone myself, as more often than not, there’s always more than one really good session running in the same time slot!

My three big take-aways were Tomcat 7, Spring MVC 3.1 update and the Spring Data Project, which I’ll talk about here.

Tomcat 7

So, first up, after the keynote, was a brush over what’s new in Tomcat 7. I must say, there are some rather neat enhancements in v7 that I’ll be looking forward to(but not necessarily using):

  • Support for parallel deployment
    • This is fantastic IMO. This enables you to deploy multiple different versions on the same web application (WAR) concurrently, all being accessed by the same context path. Tomcat will automatically route new sessions to the latest version of the application, while current sessions on older versions will continue their requests to those versions until their session expires. This greatly reduces deployment costs, and having to worry about deployment upgrade schedules/windows. Upgrading using parallel deployments will make upgrading seamless.
  • The ability to configure an active tomcat instance via JMX from just running the server component.
    • I think this is great news for those who want absolute control over how their Tomcat instance is configured. With the capability of being able to configure tomcat in this fashion, opens the doors for tools/utilities to be written to programmatically create instances just how you like them.
  • The new Cross Site Request Forgery(CSRF) protection filter
    • This filter basically generates a nonce value after every request, and stores the value in the user’s session. The nonce has to be added as a request parameter on every request, and Tomcat will verify if the values are the same, to check to see if the request wasn’t from somewhere else.
  • Various default configurations
    • Access Logs on by default
    • LockoutRealm used by default
    • DefaultServlet serves content from the root of the context by default

I was glad to hear that SpringSource tc Server and the Tomcat 7 source were being kept in line , and felt at ease when I was reassured that whatever changes are being made in TC7 are soon finding their way into SpringSource tc Server.

Spring 3.1 MVC Update

I’m noticing more and more of a focus these days on Java based configuration with Spring, and this was highlighted in the Spring MVC session. Rossen Stoyanchev did a good job highlighting this point, and gave some good examples which demonstrated this. I’m still not 100% converted though, and I still feel that there is a place for xml configuration, but if I’m honest, I am beginning to find myself coding my configuration more these days.

There is much better support now for making customisations to any one or more aspects of the mcv namespace. whereas before if you were happy with the default configuration setup, all you previously had to do to setup most of the web bits was to have the following line in your xml config:

<mcv:annotation-config/>

However, if you wanted to setup an xml marshaller for example, then you pretty much had to redefine all the parts that the previous convinience xml fragment did for you. This was very much a pain, and now is easy to accomplish.  All that is required is that you annotate your configuration class with @EnableWebMvc(yes, you have to use the java based configuration route if you want to avert the previous pain) and extend the WebMvcConfigurerAdapter class. The WebMvcConfigurerAdapter class provides you with many callback methods to add to/modify what is configured by default.

Along with easier MVC configuration, there is also now a bit more transparency about what gets configured for you under the hood. If you take a look now at theWebMvcConfiguration class, you can now see what’s being configured for you now by default.

Other areas which were mentioned, but I am yet to explore, are features around pre/post validation hooks, as well as pre/post bind when binding your form object to a controller method invocation.

Spring Data Project

Now this is something quite exciting, and rather new to me. I like the idea Spring has here to build a data-access framework to give developers the capability to have their business object data stored in different data stores. The clever people over a SpringSource have built it in such a way that you can even have different parts of your domain object for example, stored in different data stores, so you might have some info stored in a graph database, some info in a regular RDBMS store, and if you have data that has no relation to anything, but you still need to store it, you can have that stored in a NoSQL data store, and all this, will be transparent to the user. Brilliant! If you have a application that stores data(who doesn’t?!), then I’d strongly suggest that Spring Data be given a once over. I for one think its a move forward in the right direction, empowered to store your data where it needs to be stored best, without having to worry about the vast amount of plumbing involved to get it done!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s