1 - Is DDD correct to let domain objects be fed by JSF through EL?
// classe da camada de dominio
public class Cliente {
private String nome;
// getters e setters;
}
// bean ligado diretamente ao objeto de dominio
#{bean.cliente.nome}
I wonder why in ASP staff use the VM to feed user inputs and automapper to convert VM data to a domain object.
2 - If this is allowed, in case I use the CDI, should I inject these classes upstream into the managedBeans or should their instance come from within the domain layer (a service class, for example)?
// usando cdi para injetar
@named
class Bean{
@inject
Cliente cliente;
}
or
@named
class Bean{
Cliente cliente;
Bean(){
cliente = servico.getInstanciaCliente();
}
}