Matt RaibleMatt Raible is a Web Architecture Consultant specializing in open source frameworks.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

RE: Moving from Spring to Java EE 6: The Age of Frameworks is Over

Last Tuesday, Cameron McKenzie wrote an interesting article on TheServerSide titled Moving from Spring to Java EE 6: The Age of Frameworks is Over. In this article, Cameron says the following:

J2EE represents the past, and Java EE 6 represents the future. Java EE 6 promises us the ability to go beyond frameworks. Frameworks like Spring are really just a bridge between the mistakes of the J2EE past and the success of the Java EE 6 future. Frameworks are out, and extensions to the Java EE 6 platform are in. Now is the time to start looking past Spring, and looking forward to Seam and Weld and CDI technologies.

He then links to an article titled Spring to Java EE - A Migration Experience, an article written by JBoss's Lincoln Baxter. In this article, Lincoln talks about many of the technologies in Java EE 6, namely JPA, EJB, JSF, CDI and JAX-RS. He highlights all the various XML files you'll need to know about and the wide variety of Java EE 6 application servers: JBoss AS 6 and GlassFish v3.

I don't have a problem with Lincoln's article, in fact I think it's very informative and some of the best documentation I've seen for Java EE 6.

I do have some issues with Cameron's statements that frameworks are mistakes of the J2EE past and that Java EE 6 represents the future. Open source frameworks made J2EE successful. Struts and Hibernate came out in the early days of J2EE and still exist today. Spring came out shortly after and has turned into the do-everything J2EE implementation it was trying to fix. Java EE 6 might be a better foundation to build upon, but it's certainly not going to replace frameworks.

To prove my point, let's start by looking at the persistence layer. We used to have Hibernate based on JDBC, now we have JPA implementations built on top of the JPA API. Is JPA a replacement for all persistence frameworks? I've worked with it and think it's a good API, but the 2.0 version isn't available in a Maven repo and Alfresco recently moved away from Hibernate (which == JPA IMO) to iBATIS for greater data access layer control and scalability. Looks like the age of frameworks isn't over for persistence frameworks.

The other areas that Java EE 6 covers that I believe frameworks will continue to excel in: EJB, CDI, JSF and JAX-RS. Personally, I don't have a problem with EJB 3 and think it's a vast improvement on EJB 2.x. I don't have an issue with CDI either, and as long as it resembles Guice for dependency injection, it works for me. However, when you get into the space I've been living in for the last couple years (high-traffic public internet sites), EJB and things like the "conversation-scope" feature of CDI don't buy you much. The way to make web application scale is to eliminate state and cache as much as possible, both of which Java EE doesn't provide much help for. In fact, to disable sessions in a servlet-container, you have to write a Filter like the following:

public class DisabledSessionFilter extends OncePerRequestFilter {

    /**
     * Filters requests to disable URL-based session identifiers.
     */
    @Override
    protected void doFilterInternal(final HttpServletRequest request,
                                    final HttpServletResponse response,
                                    final FilterChain chain)
            throws IOException, ServletException {

        HttpServletRequestWrapper wrappedRequest = new HttpServletRequestWrapper(request) {

            @Override
            public HttpSession getSession(final boolean create) {
                if (create) {
                    throw new UnsupportedOperationException("Session support disabled");
                }
                return null;
            }

            @Override
            public HttpSession getSession() {
                throw new UnsupportedOperationException("Session support disabled");
            }
        };

        // process next request in chain
        chain.doFilter(wrappedRequest, response);
    }
}

What about JAX-RS? Does it replace the need for frameworks? I like the idea of having a REST API in Java. However, its reference implementation is Jersey, which seems more like a framework than just Java EE. If you choose to use JAX-RS in your application, you still have to choose between CXF, Jersey, RESTEasy and Restlet. I compared these frameworks last year and found the Java EE implementation lacking in the features I needed.

Finally, let's talk about my-least-framework-web-framework: JSF. The main reason I don't like JSF is because of its 1.x version. JSF 1.0 was released a year before the Ajax term was coined (see timeline below). Not only did it take forever to develop as a spec, but it tried to be a client-component framework that was very stateful by default.

History of Web Frameworks

Now that JSF 2.0 is out, it has Ajax integrated and allows you to use GET instead of POST-for-everything. However, the only people that like Ajax integrated into their web frameworks are programmers scared of JavaScript (who probably shouldn't be developing your UI). Also, the best component development platform for the web is JavaScript. I recommend using an Ajax framework for your components if you really want a rich UI.

Sure you can use the likes of Tapestry and Wicket if you like POJO-based web development, but if you're looking to develop a webapp that's easy to maintain and understand, chances are that you'll do much better with traditional MVC frameworks like Spring MVC and Struts 2. The simplicity and popularity of Rails and Grails further emphasize that developers prefer these types of web frameworks.

Another reason I don't like JSF: there's very few developers in the wild happy with it. The major promoters of JSF are book authors, trainers, Java EE Vendors and MyFaces developers. Whenever I speak at conferences, I ask folks to raise their hands for the various web frameworks they're using. I always ask the JSF users to keep their hands up if they like it. Rarely do they stay up.

So it looks like we still need web frameworks.

Eberhard Wolff has an interesting post where he defends Spring and talks about the productivity comparisons between Spring and Java EE. He recommends using Grails or Spring Roo if you want the level of productivity that Ruby on Rails provides. That's a valid recommendation if you're building CRUD-based webapps, but I haven't developed those in quite some time. Nowadays, the apps I develop are true SOFEA apps, where the backend serves up XML or JSON and the frontend client is HTML/JavaScript/CSS, Android, iPad or Sony Blu-Ray players. On my current project, our services don't even talk to a database, they talk to a CMS via RESTful APIs. We use Spring's RestTemplate for this and HttpClient when it doesn't have the features we need. Not much in Java EE 6 for this type of communication. Sure, Jersey has a client, but it's certainly not part of the Java EE spec.

As far as getting Ruby on Rails' zero-turnaround productivity, I don't need Grails or Spring Roo, I simply use IDEA and JRebel.

Conclusion
I don't see how new features in Java EE 6 can mean the age of frameworks is over. Java SE and J2EE have always been foundations for frameworks. The Java EE 6 features are often frameworks in themselves that can be used outside of a Java EE container. Furthermore, Java EE 6 doesn't provide all the features you need to build a high-scale web app today. There's no caching, no stateless web framework that can serve up JSON and HTML and no hot-reload productivity enhancements like JRebel. Furthermore, there's real excitement in Javaland for languages like Scala, Groovy and JRuby. All of these languages have web frameworks that've made many developers happy.

Here's to the Age of Frameworks - may it live as long as the JVM!

P.S. If you'd like to hear me talk about web frameworks on the JVM, I'll be speaking at The Colorado Springs Open Source Meetup and Devoxx 2010 in the near future.

Posted in Java at Oct 16 2010, 03:19:07 PM MDT 37 Comments
Comments:

McKenzie only makes our jobs as a software developer harder with rubbish like this. Java EE is a spec, not a software implementation. To say a spec means the end of a framework is quite absurd. Perhaps we will go back to the time when we use the reference implementation of each spec instead of a framework with all the pieces of the puzzle included, but comments like this only confuse non-technical managers that we have to report to or that pay the invoices.

Posted by Brian Jordan on October 16, 2010 at 03:50 PM MDT #

Hi,

I have following you for 2 years, you have enlightened me about java web frameworks, this year, after trying lots of java web frameworks, jsp, rife, gae, gwt, grails, I switched to play framework, it is developing now but it rocks when compared to others i used. give it a try, I am switching to ruby on rails now, and pretty happy with that, if you are still using java, you will be happy by trying that it is simple and fast (really :) ), here is a presentation.

http://www.slideshare.net/areelsen/introduction-playframework

Posted by yekmer on October 16, 2010 at 04:39 PM MDT #

Amen.

Posted by Keith Donald on October 16, 2010 at 04:48 PM MDT #

BTW, your blog is the top hit on Google for SOFEA.

Posted by Leo on October 16, 2010 at 08:49 PM MDT #

Well said Matt.

You write great blog entries. Have been following your blog forever.

Looking forward to your presentation at Devoxx, and maybe even have a chat if you stop by my employers booth (FuseSource). James Strachan and Rob Davies is there as well.

Posted by Claus Ibsen on October 17, 2010 at 01:20 AM MDT #

With Java EE 6, the platform is more extensible as it ever was (fragments, ServletContainerInitializer, CDI extensions ...) so you're welcome to use frameworks.

The question really is "how many people will require to use what's not already in the box?" (i.e. run high-traffic sites, which can probably scale with distributed cache technologies btw). With JavaEE6 that number is going down. By how much? Time will tell.

Also, make sure you look at EJB 3.1, not just 3.0. And I have to say that JAX-RS seems to me like the most widely adopted Java EE 6 API so far notwithstanding the limitations you've found (for things outside the spec, sure, knock yourself out, use any "framework" you'd like). As for JSF, I'm not even going to try to convince *you* of anything :)

Posted by Alexis MP on October 17, 2010 at 03:18 AM MDT #

Nice post Matt, although I'm disagree with your point regarding Roo/Grails (naturally :)

I personally don't by the meme that "rich clients == no need for server side frameworks". You still need persistence (sql & nosql), caching, job scheduling, mail, REST, XML/JSON processing etc. and there is still plenty of room for innovation in server frameworks.

Grails and Roo for example have fantastic support for sending JSON and/or XML responses plus retrieving the data that form those XML responses from your datastore.

Posted by Graeme Rocher on October 17, 2010 at 03:28 AM MDT #

Great article! A world without java webframeworks and just JEE? That would mean a lot of productivity loss!

Posted by Kai Grabfelder on October 17, 2010 at 04:12 AM MDT #

Totally agree with you Matt. By the way, when will you post again about SOFEA/SOUI ?

Posted by Nicolás Cornaglia on October 17, 2010 at 04:36 AM MDT #

Hey Matt - as always great post and I agree with your observations.

It would be interesting to know the name of the CMS backend you are currently using.

Posted by Lars Fischer on October 17, 2010 at 04:45 AM MDT #

Interesting post. Which Ajax framework can you recommend for rich UI components?

Posted by Michael on October 17, 2010 at 05:14 AM MDT #

Well, I see all this JEE6 movement just like propaganda from the JBoss/RedHat camp. They were always jealous of Spring and its success, so they just copied most of the Spring concepts, added/changed some stuff (with the advantage of doing it 4 years later, with a lot of more experience and technology available), pushed it a lot into the JSR process, and now they want to present themselves as the saviours of the Java universe.

Unfortunately, many non-technical managers and people who ultimately (wrongly) take decisions, usually buy all this marketing BS.

Posted by Alex on October 17, 2010 at 05:17 AM MDT #

Hi Matt,

Thank you for this very even keeled evaluation :) I agree with just about all of your points - in fact, I can't think of one that I disagree with.

I think it's very important to mention the fact that documentation in Java EE 6 is a severe sore-spot. With better centralized and better laid out user-driven use-case-oriented documentation of the various specifications contained within Java EE, I do firmly believe that people would find using it much simpler.

If the vendors could get together with oracle and provide such documentation, even using frameworks on top of Java EE would become easier.

Also, I wish that JSF were simpler- JSF 2.0 has made huge strides, and really is powerful when it comes down to abstracting away complexity and web-operations (not to mention the integration with other EE technologies,) but in terms of usability and principle of "least surprise," it could use some work.

This being said - I'd love if all the developer in the wild could send their ideas and complaints to the JSF-314 (JSF) expert group, most issues actually are taken into consideration, and this is how things get better. If you can't beat em- join em!

https://javaserverfaces-spec-public.dev.java.net/servlets/ProjectIssues (You have to log in to create issues.)

Jax-RS is truly a gift from the silicon gods.

Thanks again for your nice writeup!

--Lincoln

Posted by Lincoln on October 17, 2010 at 09:12 AM MDT #

Matt,

Nice post. Couldn't agree more. Long live the age of frameworks (and choice)!

Posted by Josh Long on October 17, 2010 at 10:36 AM MDT #

I agree with you Matt, there are always be unique problems out there to solve with the base of any current foundations, then the best improved pattern and enhanced framework are the tools to solve the problems. It is the circle of life.

Thank with the nice article, and long live framework improvements...

Cheers

Arif Budimartoyo

Posted by Arif Budimartoyo on October 17, 2010 at 04:48 PM MDT #

Great post! Also, with the elegance and ease of Scala, JRuby and Groovy (and their frameworks), going pure Java EE 6 way today is a move towards complexity and confusion. I don't want it, if anyone does, all I can do is wish them luck!

Last but not the least, I have been closely involved with both JSF and CDI (at least in the past) and can say that while those frameworks are nice and have their special place basing all apps on them is like wearing a 3-piece suit to a beach. Server side centric UI component life-cycles and stateful objects can make scalable application development extremely tricky to say the least.

Posted by Shashank Tiwari on October 17, 2010 at 11:29 PM MDT #

"...frameworks are mistakes of the J2EE past"?

I thought he said frameworks "are really just a _bridge_ between the mistakes of the J2EE past and the success of the Java EE 6 future".

Kinda meant that frameworks were created to fix J2EE's mistake. Where did he hint that frameworks _are_ mistakes?

Posted by Zefi on October 18, 2010 at 12:42 AM MDT #

[Trackback] This post is intended to be a reference for those evaluating or contemplating using JSF. Once in a while, I find myself having to convince people that there are far, far, better alternatives to JSF. With this blog post finally in place, from now on I w...

Posted by Incremental Operations on October 18, 2010 at 01:32 AM MDT #

Hi Matt, thanks a lot for this great work! I think I will keep going on with my tomcat cluster. I'm also really happy to see that you like JRebel. Just a few words about Spring : I made an experience to migrate a Spring+Struts based webapp without any db connection to Google Apps Engine.. I just changed the log confi file and added an appengine-web.xml. Of course, this wouldn't be possible with an application sticked to a big cointainer like JBoss. It's always the same debate...

Posted by alexdp on October 18, 2010 at 02:17 AM MDT #

@Alex
"Unfortunately, many non-technical managers and people who ultimately (wrongly) take decisions, usually buy all this marketing BS."

Manager can't ignore reality of dealines and availability of resources with the right qualifications. If the technical lead ask for 10 resources than have experience with framework A, F and Z (whatever his favorite blend) and the manager contacts 20 brokers who can only find 3 available resources with those qualifications for the 10 month timeslot of the project then he is bust. That is why its important that someone tries to "jealously copy" (to use your words) the common traits of framework such as guice and spring into jee. If all servers be it ibm, bea, oracle, redhat etc didn't try to find some common ground then the job market would be a hell of of a lot less flexible. You may see it as marketing BS to buy into that but I can tell from working closely with brokers that building teams for large IT project is very difficult. Even when the buyer is ready to spend insane amounts of cash some project are delayed for month or years or cancelled because they wan't continue extending ontop of framework A, F and Z but resources just aren't there.

Posted by Lumpur on October 18, 2010 at 03:54 AM MDT #

I disagree with the fact that you say: "I recommend using an Ajax framework for your components if you really want a rich UI."

If you are building a web APPLICATION use a decent RIA framework like flex/gwt/silverlight.

(I know gwt uses javascript, but it's more like bytecode from the gwt perspective than really a language)

Javascript is fine as long as you are building web SITES where the bulk is static data, not advanced UI components, all js components are basically hacks on top of things that were never supposed to be doing that in the first place.

Posted by Kris Hofmans on October 18, 2010 at 05:23 AM MDT #

Thank goodness for that. Java-related sites would have lost about 75% of their content if there were no more "frameworkA-is-better-than-frameworkB" posts!

Posted by Kit Davies on October 18, 2010 at 06:27 AM MDT #

Saying that the time of frameworks is over is like saying that Java is dead. There is still far too much room for innovation and frankly there always will be regardless of language. Programming is a moving target and truthfully one major corporation can't ever move fast enough. Frameworks are born of the minds of a large number of people and companies, that alone makes them a necessary part of the computer programming world. While I think the proliferation of frameworks is a fragmentation we can do without, I see the necessity of them whenever a really good one hits. If I can make a crude analogy, frameworks in Java, at least, are a lot like the add-ons in World of Warcraft. They aren't absolutely necessary, but the added features and ease of use they supply make them worth the hunt for the truly good ones and that will keep them alive.

Posted by Chris Arthur on October 18, 2010 at 06:34 AM MDT #

"Frameworks are mistakes of the J2EE past and that Java EE 6 represents the future."

The assertion was more that frameworks addressed the mistakes of J2EE, not that the frameworks themselves were mistakes. But it's a minor point.

Great article. It's featured at the top of the TSS newsthread today. I may need to conjure up a reply to your reply.

Posted by Cameron McKenzie on October 18, 2010 at 09:55 AM MDT #

Matt - Great article as always.

The one thing that I will note is that in this statement:

"I do have some issues with Cameron's statements that frameworks are mistakes of the J2EE past and that Java EE 6 represents the future. "

I don't think he is trying to say that the frameworks themselves are the mistakes, but they were bridges around the mistakes, and that those "bridges" these day's should be build at extensions to JEE.

My problem with that is that he is saying that people shouldn't really question the direction of Java anymore, and I think that is a bad assumption. It was the questioning of the direction of java during the "dark days of programming" when both Sun and Microsoft were chasing each other down a dark rabbit hole that brought about frameworks such as Spring. And I think nobody questions that things such as Spring and Seam is what bought about the new JEE 6.

So to say that the Age of Frameworks is over I think is a bad idea. Imagine if someone had written this during the time of J2EE and COM/DCOM - and programmers unfortunately listened to them (or abandoned the platform all together).

David Sachdev

Posted by David Sachdev on October 18, 2010 at 11:05 AM MDT #

"However, the only people that like Ajax integrated into their web frameworks are programmers scared of JavaScript (who probably shouldn't be developing your UI). Also, the best component development platform for the web is JavaScript. I recommend using an Ajax framework for your components if you really want a rich UI."

Seriously, man, are you just slow or just play someone like that on your blog!? You actually assert that using dynamically-typed language, with no type checking is the way to go for developing applications (non-trivial variety is assumed here)? So how about a follow up article on refactoring the UI on some application with say 30 or so pages that are heavily customized in terms of JavaScript effects, etc?!

I would much rather rely on something like GWT, that gives me the statically-typed abstraction of Java, where I can add my on JavaScript if need be but for the majority of cases it's abstracted away and can be refactored, etc.

Posted by Roy Nid on October 18, 2010 at 11:56 AM MDT #

@Roy: I think refactoring and maintenance of applications written in a dynamically typed languages are possible but I think it requires a solid amount of automated integration tests.

With GWT or other java componed based frameworks like Wicket it's much easier to perform heavily refactorings with much less need of complete and complex integration tests...

Posted by Kai Grabfelder on October 18, 2010 at 12:14 PM MDT #

IMHO, JEE spec is to frameworks what language/platform is to design patterns. we need both. may the best solution combining both win !

Posted by sanjeev on October 19, 2010 at 11:03 PM MDT #

Wow, Matt you are still reading TSS? I stopped reading their flame-bait a while ago which is how I ended up with troll status on this post. *sigh* The framework argument has raged for a long time and so it's no surprise that JEE wants to try and get its seat back at the table. The problem is that JEE is trying to grab that seat with its name rather than innovating. They are saying, "Hey, all that cool shit you needed. We have now too." But that is not really enough to switch. For my money, I don't really see you are doing that much better than the little guys that pioneered the patterns. Also, in a way you are asking me to get heavy if I am serious. Riiiiiggghhht. Maybe I should just try an Oracle Forms install instead.

The way JEE is sold makes it the VB of Java. "We do it all for you so you don't have to." It's there to help the dummies and the noobs get something off the ground but it ends up just being conferenceware. So, if I hire you to build something and you know your tools and have your recipes; you have an opinion on how all the pieces should fit together today and why that arrangement will pay off later, then I really don't care what framework you use because a dumbass with Struts2 is the same as a dumbass with JEE is the same as a dumbass with RoR. </troll>

P.S. I am working with the RestTemplate and HttpClient to talk to the Sling API of the Day CMS. A very cool setup indeed...

Posted by Dustin Pearce on October 22, 2010 at 08:53 AM MDT #

Hi,

Matt, i certainly don't agree with you, it seems you are afraid of paradigm shift and just wanted to stay with your old world, I once told that people are stuborn for changes, specially when they want to stick to the old tool of trade they already new.

So, now you say that the existing frameworks are so great that we don't need new technologies. which i just don't agree!!! why don't you change your name to Raible to Rebel. The Rebel of new technologies.

You have no understanding of Specs, RI and the Production capable implementations.

Sorry i am a bit harsh but someone has to show you the mirror.

Wakey Wakey rise and sunshine come out of dungeon and shit frameworks and code to the standards, I see Java EE 6 just an effort to standardized stuff so any Implementation can be hooked up.

Posted by Naveed Hussain on October 26, 2010 at 09:47 AM MDT #

I believe Raible is the Appalachian spelling for Rebel.

Posted by Dustin Pearce on October 26, 2010 at 10:00 AM MDT #

Hi Matt

Great post - been missing ones likes these from you. I've been following you since I built my 1st AppFuse app in 2006. That app is still around (JSF, Spring, Hibernate flavour of AppFuse 1). Looking at it now, compared to the stuff I've been doing with the awesome (read: simple, elegant, productive and fun) Play! Framework.... what a world of difference :)

I know you've looked at Play a while ago - would be interesting to hear your thoughts on it now.

Posted by Johan Vosloo on October 30, 2010 at 01:39 PM MDT #

Nice post. Totally agree. Frameworks will live as long as people can have ideas.

Posted by Hans Ospina on November 19, 2010 at 01:54 PM MST #

[Trackback] Someone referenced this post to answer question "When I say the word "spring"?"...

Posted by Copious-Systems on December 01, 2010 at 08:20 AM MST #

when you say "I recommend using an Ajax framework for your components if you really want a rich UI." - do you have any recommendations that are not YahooUI?

Posted by Alistair Thomas on December 08, 2010 at 08:41 AM MST #

[Trackback] If the Web wasn&#8217;t tragically amnesic, I could show you 15-year old articles explaining how XSLT was about to revolutionize Web applications. In that vision, your Web server would return an XML file with all the data; and alongside that XML, an XS...

Posted by William Vambenepe&#039;s blog on July 25, 2011 at 03:06 PM MDT #

Hi Matt,

My site Internet Polyglot is still using your Appfuse 1 and works very well. It's time though to move to a new framework and it seems that at this moment Play! framework is the best choice.

Mikhail

Posted by Mikhail Gavryuchkov on September 29, 2011 at 04:51 PM MDT #

Post a Comment:
  • HTML Syntax: Allowed