1
resposta

mensagem no navegador: not found

Classe agendamentoEmailServico :

package br.alura.servico;

import java.util.List;

import javax.ejb.Stateless; import javax.servlet.annotation.WebServlet;

@Stateless public class agendamentoEmailServico {

 public List<String> lista(){
     return List.of("filipy.hughes@gmail.com");
 }

}

Classe agendamentoEmailServlet :

package br.alura.servlet;

import java.io.IOException; import java.io.PrintWriter;

import javax.inject.Inject; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;

import br.alura.servico.agendamentoEmailServico;

@WebServlet("emails") public class agendamentoEmailServlet extends HttpServlet{

private static final long serialVersionUID = 1L;

@Inject
private agendamentoEmailServico servico;

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    PrintWriter pw = resp.getWriter();
    servico.lista().forEach(listando -> pw.print("EMAIL: " + listando));
}

}

1 resposta

Gabriel, boa tarde. Qual url vc está usando para acessar?