I have two Jars A and B where A depends on B.
Jar B has a single class:
@ApplicationScoped
public class MyMa
I was having this exact same problem and I was able to get it figured out but I use an ear to combine the jars.
Ear Layout
project.ear
|-- META-INF
| |-- MANIFEST.MF
| |-- application.xml*
|-- one.jar (bean archive)
| |-- META-INF
| | |-- beans.xml
| |-- <code>
|-- two.jar (ejb)
<application>
<display-name>test-application</display-name>
<module>
<ejb>two.jar</ejb>
</module>
<module>
<java>one.jar</java>
</module>
</application>
Doing that it made one.jar available to two.jar in the container.
-kurt
Make sure both jars are "bean archives" - i.e. they have META-INF/beans.xml
One thing, you have to create Qulifier annotation for specify exactly which should be injected.
@Qualifier
@Retention(RUNTIME)
@Target({METHOD, FIELD, PARAMETER, TYPE})
public @interface UserConfiguration { }
and then..
@Produces
@UserConfiguration
@Named("user")
public String getUser(){
return "myUser";
}
for injection..
@Inject
public MyManagedBean(@UserConfiguration String user){
this.user = user;
}
see also http://docs.jboss.org/weld/reference/1.1.0.Final/en-US/html_single/#d0e1355