Is it Java EE compliant to have an empty constructor in a stateless EJB using a non-injected field as in the example?
@WebService
@Stateless
@SOAPBinding(...)
@RunAs(...)
public class ParameterWebservice {
@EJB
private PService pService;
private final Set<PrivacyO> allowed;
public ParameterWebservice() {
allowed= new HashSet<>();
allowed.add(PrivacyO.EXPOSE_THROUGH_LAYER_A);
allowed.add(PrivacyO.EXPOSE_THROUGH_LAYER_B);
}
...
}
Is it Java EE compliant to have an empty constructor in a stateless EJB...
Yes, the ejb 3.1 specification says:
4.9.2 Session Bean Class
... • The class must have a public constructor that takes no parameters. The container uses this constructor to create instances of the session bean class. ...