Here's how I got it to work (Spring 2.5.2).
In myapp-servlet.xml, I have something like:
Code:
<bean id="jndiFactory" class="org.springframework.jndi.support.SimpleJndiBeanFactory">
<property name="resourceRef" value="false" />
</bean>
<bean class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor">
<property name="alwaysUseJndiLookup" value="true" />
<property name="jndiFactory" ref="jndiFactory" />
</bean>
<bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor" />
<context:component-scan base-package="com.myapp.controllers" annotation-config="false" />
This basically sets up annotation-based component scanning and dependency injection using a custom JndiFactory that's configured not to prepend lookups with java:comp/env.
Spring does pretty much does everything else: upon seeing HomeController annotated with @Controller, it scans it and sees limsRepository annotated with @EJB, looks up "beanName" in JNDI, and so on and so forth.
Had to wrestle with various naming problems (I use @EJB(mappedName = "..."), YMMV) depending on the application server, but this has worked for me on both Glassfish v2 and JBoss 4.2.