Why it’s time to forgive EJBs for the complexities of 2.x
Spring - an application framework and inversion of control container for the Java platform. sprung - past participle and past of Spring.
I first encountered Spring in the Summer of 2006 while on contract at a German mobile communications company, which we shall call ‘T’ for brevity. Strange really as I’d been taken on as an EJB developer and for my bea WebLogic Application Server experience. But ‘T’ had software consultants in from the subsidiary of a German car manufacturer and we all know that consultants know best. Never mind the hundreds of thousands of pounds they spent annually on bea WebLogic licences.
Their lead developer was from the Midlands and consequently stayed down Monday to Friday, which meant he carried on programming long after the rest of us had gone home. So when we came in next day some of the code we were working on had been finished. I admired his commitment and appreciated there was little to do in the evenings in a depressed Hertfordshire town whose major industry had flown. But when you’re trying to learn a new framework this was the last thing you needed. Maybe it was this and never having to work out any problems or issues myself that didn’t give me the appreciation of Spring.
Also, I like to consider myself a Java Developer, not an XML configurator and Software Development as a profession, has moved beyond XML. It’s incredibly verbose but that’s just a minor starting gripe. Much more importantly, I don’t want to program in XML.
At this point the usual come back is “you can do Spring with annotations now! No more XML”. But I don’t think for one minute all that legacy Spring, especially sitting around in our financial institutions, has been upgraded to use annotations.
Spring also offered IoC/DI (Inversion of Control & Dependency Injection) out of the box. This was during the J2EE era configured by XML which could go quite overboard.
Back in the dark J2EE ages, when EJB 2.x was (allegedly) extremely difficult to implement Spring may have offered a better alternative which required less Java code (but still tons of XML). J2EE/EJB2 learned lessons from Spring and came up with Java EE 5 which offered the new EJB3 API which was slicker than Spring and required no XML at all.
Move on a decade or so and we now have EE 8. Java EE is now open source and has been taken over from Oracle by The Eclipse Foundation and Java EE renamed Jakarta EE.
- EJBs no longer require a local or remote interface, Just annotate with @local or @remote
- JBoss WildFly 12.0.0.Final starts and deploys all your EJBs in under 10 seconds. Try and get anywhere near that with Apache TomCat and Spring.
- Context Dependency Injection (CDI) is out of the box.
- JPA 2.2 with support various ORM dialects (Hibernate, EclipseLink, Apache OpenJPA, TopLink).
The EE 8 spec also includes:
- JavaServer Faces (JSF) 2.3.
- Java API for WebSockets
- Java API for JSON Processing (JSON-P)
- Java API for RESTful Web Services (JAX-RS)
- Java Servlet
- Expression Language (EL)
- Java Message Service (JMS)
- Concurrency Utilities for Jakarta EE
- Batch Applications for the Java Platform
- Bean Validation
- Java Connector Architecture
- Java Transaction API (JTA)
- JavaServer Pages (JSP)
All we need is one Financial Institution to say “It’s back to the future” and Spring will have well and truly sprung.