I\'m following the MVC unit test instructions from this site,
but I cannot find the jar for the @Inject
annotation. Does anybody know where the jar is?
Via Maven:
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
Or from the Project Home Page: http://code.google.com/p/atinject/
Also, this MvnRepository.com page provides the necessary configurations for other build tools like Ivy, Gradle etc.
You can use Sun's official:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
</dependency>
Cheers!
Using javaee-api
instead of javax.inject
I ran into a bunch of issues.
After some digging I found out that you need to add it with scope provided or otherwise it will add a Listener (com.sun.faces.config.ConfigureListener
) at runtime.
Another issue is that apparently the implementation to inject is different. Fields annotated with @inject
remained null. By replacing the official sun jar with the javax.inject
, this no longer happened.
Note that i'm not an expert, I might be running into side-effects, but figuring this out took me such a long time, that I felt I had to share my findings so far.