tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reza Rahman <>
Subject Injection into Unit Tests
Date Sun, 10 May 2009 14:29:26 GMT

I am currently using Spring JUnit 4 support classes to inject OpenEJB 
Session Beans into unit tests. Here is the code:

@RunWith(SpringJUnit4ClassRunner.class) // Bootstraps Spring inside the 
@ContextConfiguration(locations = { "/applicationContext.xml" }) // 
Responsible for instantiating OpenEJB and injecting the EJB below.
public class AccountServiceTest {
    @EJB(mappedName = "DefaultAccountServiceLocal") // Spring processes 
this @EJB annotation to perform the injection from an OpenEJB JNDI instance.
    private AccountService accountService;

I would like to avoid using Spring just for this. Does OpenEJB provide 
support for anything similar to SpringJUnit4ClassRunner?

Many thanks in advance,
Expert Group Member, EJB 3.1 and Java EE 6
Author, EJB 3 in Action
Independent Consultant

View raw message