Category Archives: spring integration

The state of Spring so far…

I-heart-spring-AidenI have never been more excited to be a part of the Spring team as I am now. It feels like we are blazing new trails left and right. Seeing the massive turnout this week for Stephane and Brian’s “Spring Boot University”, a 3-hour session at DevoxxFR, left me awestruck. Wish I could have been there.

Everywhere I turn, people are gobbling up Spring Boot. They tell me, this is what they have been looking for. How did this happen? It’s a really neat history.

A little bit of history

The Spring Framework started lean and mean. It was a fantastic way to integrate critically needed tools through its profound power of dependency injection. Some people criticized this as hype, but the community’s massive adoption proved the vitality of this approach. Coding was fun! Demo apps are one thing, but people were using Spring Framework to build large, complex systems. Complex systems need lots of components. Existing APIs like JMS, JDBC, and other things came with the need for lots of plumbing. These APIs were way too low level. And thus was born JmsTemplate, HibernateTemplate, and my personal favorite: JdbcTemplate.

But that was not all. Building web apps with Spring MVC was hot. It made testing app controllers nice and easy. You weren’t obligate to run web-based acceptance tests through complex controls. Instead, you could isolate things. Nonetheless, as the needs of the community grew, so did Spring. To help different parts of Spring grow and evolve and now slow down the core framework. other projects were formed. Spring Security, Spring Data, Spring Integration, Spring Batch, and more. At one point, people expressed their dislike for “spring.jar” containing everything. The Spring team chopped things up into finer grained JARs so you could grab what you needed. Then we had too many JARs. What?!?

As the power and might of Spring grew, so did its learning curve. People were asking which project to use. How to integrate them together. What version of Spring Integration with the version of Spring Framework I’m using? How do I even start using Spring MVC? What steps do I need to carry out?

Spring Boot is born

platform-spring-bootThus was born Spring Boot. Spring Boot brought forth a series of critical concepts.

  • Pre-pick the versions of Spring and other libraries so you don’t have to
  • Auto-configure boilerplate stuff like Spring MVC, Security, Integration, etc.
  • Remove key beans if you define your own
  • Accelerate Spring’s power of externalization of properties to Warp Factor 9!
  • Add on DevOps-ready metrics

A big hurdle was mixing together different libraries. If I have Spring Framework 4.0.1, what version of Spring Integration should I pick? Simple: pick one version of Spring Boot, and both of those dependencies are pre-picked for you. Boot doesn’t stop there. It extends into lots of key 3rd party libraries. This decision was so popular, that Spring IO was created to reach out and harmonize the versioning of 380+ libraries.

A big issue (especially for me, a non-web guy at the time), was standing up Spring MVC. First, you had to put certain bits into web.xml. Then you needed to stand up view resolvers, message converters, controllers, and a whole cadre of other components. You really needed to understand Spring MVC to do it and to do it right. Spring Boot stepped up to the plate and said, “don’t worry, we’ve got you covered”. Add “spring-webmvc” to your project, and Boot will create all that stuff for you. You just create a controller that returns view names, and you’re up and running.

danielskullNo form of automation can ever cover every circumstance. Sooner or later, developers need to break out of the framework’s default position. And this is where LOTS of tools fail on a massive scale. There are two common outcomes: 1) Don’t permit such customization and hamstring future developers or 2) Add so many extension points that the simple use case vanishes. Spring Boot introduces option 3) Drop bits of auto-configured stuff when you create your own. This is known as backing off, and has moved the bar forward on app and framework development really far. New applications and new frameworks will surely adopt this approach to expansion because it just makes sense. If you build a framework and don’t shoot for this, someone starting after you might catch up and pass you because they will.

Something I’ve needed for years before I wrote Java for my day job was externalization of application properties. I dealt with development, test, and production environments. Rebuilding apps for each target was wasteful. So I hand wrote code for that. Spring Framework has always had powerful support for properties files, but Spring Boot took that feature and accelerated the options. Having APP_ENV and -Dapp.env both map to @Value(“${app.env}”) String appEnv or class ApplicationProperties { public void setAppEnv(String env)… } is sheer genius can cannot be understated. People talk about 12-factor apps and high tech wwizbang manifestos, but this concept is simple to grok and applicable just about everywhere. You could be running a close network solution (which I did at my old job) with no cloud involvement and find this technique the Right Thing To Do.

DevOps-ready controls and metrics is something area always begging for. System administrators, program managers, business analysts, and others are always asking for this extra metadata about our apps. Being able to spit out a first cut of this by simply adding one dependency to an application is phenomenal. Then being able to craft your own metrics and controls with little effort ramps your app up to production ready and Management Friendly by providing them the warm fuzzy metrics for clients without breaking the bank of technical debt.

Where are things now?

With Spring Boot spreading across the Java ecosystem over the past two years, it really is exciting to see how much fun people are having building apps. They focus on the end game, not setting up infrastructure. Hearing chatter like “Using Spring Boot is like pair programming with the Spring team” (@starbuxman) and “Spring Boot is just what we need” is cool. I get excited to go the Nashville JUG and talk about some piece of Spring, not just because it “looks good”, but because I can sincerely point out how using it is simply fun! Isn’t that what real software is supposed to be? Functional, carries business value, and at the same time, fun to build and release? It almost feels like Spring Boot introduces yet another rennaisance to application development.

3021OS_mockupcover_normalI have been quite pleased that my previous book, Python Testing Cookbook has earned double the advance over the past three years (and keeps making me money!) But I jumped out of my chair when the first statement for Learning Spring Boot came in last month and showed that over 400 people had bought a copy. My excitement to write about Spring Boot was paralleled by my instinct that people would want to learn about Boot’s secrets.

There is a lot of action happening in the Spring team as we continue to blaze trails we couldn’t foresee five years ago. Many of our key decisions in the past have put us on a strong  footing to continue pushing the envelope for the future in both application power as well as ease of development. The community experience of putting out new features, getting feedback, and generally building something better each and everyday that helps thousands of people solve problems is both inspiring and humbling. There’s no other place I’d rather be working.

Happy coding!

SpringOne – Days 1 and 2

I finally found some time to post updates. Whew! It has been busy!

Day 1
================================
On Monday, I hooked up with the SpringSource guys. It seems everyone had something to work on. I wanted to get 0.9.0 completed and working before giving my demo of PetClinic on Thursday. Just about anyone I spoke to was polishing up their slides. It is truly fantastic to be chatting with the guys at SpringSource.

Rod Johnson gave the keynote addresss, focusing on the target goal of SpringSource in reducing the complexity of application development. Complexity means more development, more risk, and in turn, more cost. SpringSource’s overarching goal of reducing complexity must be working, because he had several metrics showing how much has been adopted in some degree by the industry.

After the keynote, I was finally able to meet up with Keith Donald. We have been playing email tag for some time, and I was surprised to find out his office is probably 10 minutes away from mine. Hopefully we can get together soon after the conference. It was also great to meet Mark Pollack, Chris Beams, Ben Alex, and of course, Rod Johnson himself. While I enjoy reading their blog entries and source code, there is no substitute for meeting the real person.

Day 2
================================
In the morning, I attended the Grail presentation. That was awesome. Graeme demonstrated building a twitter-like site using Grails in 40 minutes. Okay, he promised 40 minutes, and took 45 minutes, but only because he started adding extra functionality not found at the actual twitter site. In the process, I was realizing the value Grails places on plugins. Grails is good at creating a skeleton application, and then letting you flesh it out. I was starting to get the idea that Spring Python could use a command line utility with plugins to generate a skeleton CherryPy app, Django app, or anything else developed by a plugin. Well, I went to the next session, “Intro to Spring Security 2.5”, opened my laptop, and started coding. I managed to write a static skeleton app, and then began working on a command-line utility to dynamically generate this. That is still in progress.

I admit I was only listening with one ear to Ben’s presentation. Sorry Ben! 1) I am already somewhat familiar with Spring Security, 2) most of it is geared towards web apps which I don’t write, and 3) I was really stoked at the idea of a command-line tool that download Spring Python plugins from a network location. I did catch his question, “who here is NOT writing web apps?” I was the only person in the room who raised a hand to that. When asked what I was using, I answered “Swing desktop apps.” That plugged Ben’s point that Spring Security uses the same tactics.

After lunch, I attend two sessions about Spring Integration. This is channel based messaging, which is sort of like JMS on steroids in my book. They interface with JMS, but also with other things like file-based systems, web services, RMI, anything. And it is easy to plug in your non-message based service to a chain of processing. This is wiring your app in a different, more decoupled way. I sure could have used this about five years ago.

Later that evening, Russ and I got together to work on his Spring Extensions presentation. Russ is planning to talk about the process Spring has set up to better manage new code, and wanted to compare the process with real life, and Spring Python is his choice target. If you are at SpringOne and can read this before Thursday, I highly suggest you attend that presentation. It will definitely be entertaining (shameless plug).