Using EJB3 with Spring

In my previous entry, I talked about how you could easily use Spring from within EJB 3 beans, thanks to the magic of EJB interceptors. But what about the other way? How do you use EJB 3 from Spring?

*Update:* It looks like the Interface21 guys have had similar ideas – check out Project Pitchfork

Continue reading “Using EJB3 with Spring”

Using Spring with EJB 3

Back when we were planning the migration to Glassfish, I realised we would have two dependency-injection frameworks in use – EJB 3 and Spring. For obvious reasons, I wanted to know more about how these would interact. At the time (last July), I couldn’t find anyone who had used EJB 3 and Spring together – even Ben Alex from Interface21 hadn’t come across it. Six months later, and I still haven’t heard of anyone using Spring _from_ EJBs. Except for us.

Continue reading “Using Spring with EJB 3”

Testing EJBs without a container

One of the more annoying aspects of testing EJBs has always been the fact you need to bundle them up in a JAR (and often an EAR) and deploy them to a server to thoroughly test them. This process drags out the development of unit tests, and makes life generally painful.

As of EJB 3, however, it’s no longer necessary. instead, it is fairly trivial to mock out the container entirely (and safely!)

Continue reading “Testing EJBs without a container”

Interfaces with EJB3

Starting last October, we went through a process of upgrading the main application at Wotif to be running under Java EE 5 (not just Java SE 5). The biggest part of this was upgrading from EJB 2 to EJB 3.

One of the things I noticed was that EJB3 gives you a lot of choices for how to implement and configure EJBs and their associated interfaces. There’s a lot of “standards” on how to do it, many of them conflicting, but very little explanation of why. This is the set of standards I came up with (and was largely successful in getting implemented), and why I chose them.

Continue reading “Interfaces with EJB3”

Adding unit tests to a J2EE application

I got asked a very simple question today: how do you go about adding unit tests to an already existing J2EE app? In particular, so you can test your logic standalone, without needing to go through a deployment cycle and test it in the server?

Continue reading “Adding unit tests to a J2EE application”

%d bloggers like this: