title: Dependency injection with Spring (JSR 330 annotations) in WebSphere 7 is not working
body: <p>I have an enterprise application built with Java 6, Spring Framework 3.1.2 and Mule-ESB 3.3.0, among other libraries not related to this question.</p>
  
  <p>Our beans and services are all declared with <code>@Named</code> and <code>@Inject</code> JSR-330 annotations, respectively for automatic component scanning and for dependency injection (no EJBs, only service beans). When deployed into JBoss 4.2.3 (our test environment) everything works fine. However, when deployed into WebSphere 7, the JSR-330 annotations seem not to be working. The beans marked with <code>@Named</code> are just not detected, at all.</p>
  
  <p>I can assure everything is configured right (since it is working in JBoss). Specifically, the <code>&lt;context:component-scan /&gt;</code> has the <code>base-package</code> attribute correctly defined and the <code>scope-resolver</code> attribute correctly configured to use <code>Jsr330ScopeMetadataResolver</code> (we tried without it too).</p>
  
  <p>I am aware WebSphere 7 (7.0.0.23) may not support such kind of annotations. I am yet to test it with <code>@Component</code> and <code>@Autowired</code> Spring equivalents. Unfortunately, we would very much like to use JSR 330 annotations so our classes wouldn't directly depend on Spring, even though we're using Spring Framework under the hood.</p>
  
  <p>Nevertheless, although I'd spent one full work's day looking for a definite statement that WebSphere 7 does not support JSR 330 annotations, I haven't found anything so far.</p>
  
  <p>Further, I can't see why it would not work, since I'm assuming Spring Framework is the one doing all the work, through the <code>&lt;context:component-scan /&gt;</code> directive in the <code>application-context.xml</code> file.</p>
  
  <p>Can anyone bring some light into this issue?</p>
  
  <p>Is there a way to activate dependency injection via annotations in WebSphere 7?</p>
  
  <p>If I switch back from the JSR 330 <code>@Named</code> / <code>@Inject</code> annotations to Spring's own <code>@Component</code> and <code>@Autowired</code> is it likely to work?</p>
  
  <p>In a desperate attempt, can I extend Spring's <code>ComponentScanBeanDefinitionParser</code> so it will detect JSR 330 annotations even in WebSphere 7?</p>
  
  <p>If nothing works, I will eventually fall back to plain XML configuration. That is highly undesirable, however, because there will be hundreds of beans to be manually configured in the XML.</p>