Review of Spring Web Flow 2 Web Development

I was approached by one of the editors at Packt Publishing about doing a review of Spring Web Flow 2 Web Development.  I obviously said yes, the title of this post is “Review of Spring Web Flow 2 Web Development”  🙂  Plus, I really don’t have much experience with Spring Web Flow 2 (SWF2) and felt doing the review made perfect sense.

For those of you that appreciate my short, don’t-hold-back, opinions, I’ll start there:

Spring Web Flow 2 Web Development is both a great “getting started” book for people wanting to learn SWF2 and serves as a good high-level “getting started” with web programming using Spring / Java EE.  Definitely worth the time and money.

Now my detailed review:

Again, I really liked how Spring Web Flow 2 Web Development serves as both a jump-start on SWF2 and also covers technologies outside of SWF (Spring Security, build tools, Apache Tiles, etc).  The book isn’t a detailed reference manual, that leaves you feeling you still don’t know how to use the technology, but gives the right amount of walk-through examples and framework documentation.

When finished with the book you will understand how to install SWF2, how to build and use the examples.  You will have numerous, feature-rich examples the authors build throughout the book.  You’ll know how to use SWF2 in a request-respone Spring MVC app and also with a JSF application.  You  get a solid tutorial on using Apache Tiles (kind of odd in a SWF book), a very detailed explanation of Spring Security and integrating Spring Security with SWF.  You also will understand how to test your flow definition and SWF application while also learning about EasyMock.

Here are my bulleted notes chapter by chapter:

ch 1: Very short, brief intro to Spring Web Flow 2. High level terms and definitions

ch 2 setup and example app: install swf2 discuss the distribution discuss the example apps and how to build from src covers build systems (ant, mvn, ivy) eclipse and spring ide then a thorough example app -flow definition -service layer -dao with jpa impl

ch 3 web flow documentation detailed look at flow definition (.., scopes, states) least favorite chapter hard to read, not enough example tying concepts together

ch4 spring faces starts with intro to jsf I’m not interested in jsf

ch 5 sub flows – built on ch2 and ch3 spring javascript abstraction oddly placed apache tiles tutorial for combining swf, spring js, and tiles reference for web flow configuration

ch 6 testing swf apps covers use of AbstractXmlFlowExecutionTests short intro to EasyMock tests subflows

ch 7 really good intro spring security spring security and swf

Modular Java with OSGi and Spring

I was lucky enough to be asked to preform a technical review of “Modular Java: Creating Flexible Applications with OSGi and Spring“.  It’s Craig Walls‘ next book and it’s being published by the Pragmatic Programmers.

Craig does a great job of making the case for modular Java development with OSGi.  He covers why we need to start thinking about more than just how we design our methods / classes and focus more on how we design reusable Java modules.

First, Craig makes the case for modular design.  Then he talks about how OSGi enables us to write modular Java applications.  He covers both the Apache Felix and Eclipse Equinox OSGi containers.  Next you are writing and deploying a HelloWorld OSGi service.  And that’s all done in the first two chapters!

Craig spends the rest of the book covering modular Java and OSGi concepts through the development of an example project, Dude Where’s my JAR.  You also throughly learn an invaluable tool for OSGi development, Pax Construct. You learn about and writing and deploying OSGi bundles, then writing, deploying and consuming OSGi services.

Once you think you know everything about OSGi, and might be thinking that it’s a bit complicated, Craig brings in the Spring Framework.  He covers Spring Dynamic Modules for OSGi (Spring-DM) which is used to eliminate all of the OSGi-specific code in the example application.  You refactor the app away from depending on the OSGi API.  You change the services to POJOs and OSGi services then inject them into other beans.

My favorite thing about this book was that I didn’t have to read 1000 pages to understand the concepts and get up and running.  Like all the Pragmatic Programmer books, you are educated, and up and running in a few 100 pages.  Read this book if you want to quickly get up-to-speed on OSGi and Spring Dynamic Modules.

Keith Donald Delivers Great Spring Web Products Talk…

Last night the Spring Dallas User Group was lucky enough to convince Keith Donald to fly up and talk to us about the Spring Web products (Spring MVC, Spring Web Flow, Spring JavaScript, and Spring Faces). A large chunk of Keith’s talk was on annotation-based Spring MVC along with the Spring JavaScript product. Both looked great! Between Keith’s talk last night and Craig Walls’ talk last month, I think I’m ready start doing all my Spring MVC development via annotations.

Of course, I’ll need to spend some time getting up-to-speed on all the convention over configuration rules that are available. Thank God, that the SpringFramework has top-notch documentation, or I wouldn’t be able to figure out all the convention rules/options. (That was one of my main mental roadblocks that kept me away until now)

Keith also spent some time last night showing off Spring Web Flow, which is a great DSL for defining stateful web flows inside a Spring MVC webapp. Keith wrapped up with a very quick demo of Spring Faces. I’m sure JSF people will find value in that product, but I’ll stay with Spring MVC.

Keith’s talk was based on the samples that go with the new Spring Web Flow 2 release.

SpringFramework’s JavaConfig…

I have to admit, I was very impressed with Ryan Breidenbach’s Spring JavaConfig talk tonight at the Spring Dallas User Group.  I don’t hide the fact that I’m a big fan of xml configuration, and very much against annotation-driven config.  However, I don’t think I have a problem with doing my bean wiring in Java.  I’ll have to sleep on it, and then look at some code and blogs tomorrow before I yeah or neah it, but I kind of liked what I saw tonight.

One of the keys behind xml config, is having a central location to see how your app is wired, and you still have that with JavaConfig.  You get stronger type safety, there is no need to cast your bean from Object, and you get built-in IDE refactoring.  Ryan did a nice job showing off a lot of advanced bean-wiring methods in JavaConfig.

If you want to learn more about Spring JavaConfig go to the source and read more at the projects homepage.

Who Likes Spring MVC?

Who likes Spring MVC out there? Are you using annotation-driven Spring MVC with the 2.5 features? To me all the @RequestMapping annotations just make controller code harder to read. Call me crazy, but I’m out on annotations for doing my Spring configuration. I greatly prefer configuring my beans in common xml files that are easy to view/edit without digging through a bunch of packages / classes.

What drove me to write this post? I saw Craig Walls give a great talk on Spring MVC and Spring Security tonight at the Spring Dallas User Group. He did a good job selling the 2.5 features, but I think he did a better job selling the 2.0 mvc features. I like the idea of using ControllerClassNameHandlerMapping and InternalResourceViewResolver and getting a nice case of convention over configuration. So I guess some good conventions are better then having to go digging through source code for what my annotations are.

If you want more info, check out Craig’s presentation, which you can download from his site.

Heading to The Spring Experience…

I’ll be heading to The Spring Experience tomorrow morning. I’m very excited for many reasons. One that can’t be understated, is the weather and location of TSE, Hollywood, Florida! It’s cold and wet here in Dallas this week (30s – 50s, with rain all week).

Attending this year’s TSE will make me 3 for 3! Each one has been great, and I’m sure this one will be as well. I’m very interested in the Spring WS talks, as well as catching the Grails for Spring developers talk. The Spring Security talks should be good too, considering the the big improvements they just announced. I’ll definitely make a point to here Rod Johnson speak, at least once.

What’s everyone else that’s going to TSE excited about? Am I missing something new and exciting?

Lastly, if you read this blog, and we haven’t met, make sure and introduce yourself.  I like to put faces to the people who read and comment on this blog.