Person, I have the following structure in my project (CDI):
BEAN:
@Named
@SessionScoped
public class ClienteMB extends BaseAbstractMB<Cliente, ClienteDTO> implements Serializable {
@Inject
private ClienteService clienteService;
// METODOS
}
Service (interface):
public interface ClienteService extends BaseService<Cliente, ClienteDTO>{
// METODOS
}
ServiceImpl:
@Transactional(rollbackOn = Exception.class)
public class ClienteServiceImpl extends BaseAbstractServiceImpl<Cliente, ClienteDTO> implements ClienteService {
// METODOS
}
So far, this structure is correct, right? But in another project I work with in the ClientServiceImpl class we have an annotation called @Stateless
(Concept: No record of all previous interactions are saved)
My question is, do I really need to have the @Stateless
annotation? If so, what is its real usefulness? Because once the project is CDI, the @Stateless
annotation is EJB, right?
And why in a project I do not use annotation and other usage, and both function normally.
According to a colleague of mine, if I do not have the @Stateless
annotation I would not be able to make a @Inject
, but in the project I do not use @Stateless
I can%
Does anyone know how to explain this?