Lets say I have a class hierarchy of Human
and Student
classes like this:
public abstract class Human{
private final String type;
public Human(String type) {
this.type = type;
}
}
@Stateless
public class Student extends Human {
public Student() {
super("STUDENT");
}
}
I only need a managed bean of class Student
. But on class Human
, I get an error saying:
Managed Bean must have a constructor with no parameters, or a constructor annotated @Inject
Is there a way to tell Java that I don't want a managed bean of type Human
, and therefore I don't need a parameterless constructor?