Have you checked to make sure beans.xml is in the right place:
- .jar and .rar:
- .ear: an EAR can't be a bean archive
Still not working? Does a message about activating CDI appear in the server log, but injection still not work?
Make sure you used the right @Inject annotation. Especially with code completion and dependencies pulling Google's Guice onto the classpath it's easy to land up accidentally choosing
Yep, I just wasted twenty minutes staring at code that wasn't working before I noticed this. Time to find out which dependency is pulling in Guice, add an exclusion, and nag them to make it an
<optional>true</optional>dependency. It looks like in my case it's coming from
org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-impl-maven, so a quick:
ensured that mistake wouldn't happen again.