I've an EJB as follows:
public class Bar() {
private String s;
public Bar() {
this.s = "bar";
}
@Inject public Bar(String s) {
this.s = s;
}
}
How can I inject that bean by using the arg-constructor into another
Foo
class?Then, I define the
Foo
class as EJB, with the aim to perform the DI for it into another class (for instance, a WebServlet). How can I inject aFoo
class instance by passing aString
to properly set upBar
arg-constructor as inner-dependency?Is there a better way to define
Bar
in order to achieve points above?