Last active
October 1, 2018 16:57
-
-
Save regispires/9566966 to your computer and use it in GitHub Desktop.
Controller JSF (ManagedBean) + Spring com SpringBeanAutowiringSupport
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package br.ufc.quixada.npi.web; | |
| import java.util.List; | |
| import javax.faces.bean.ManagedBean; | |
| import javax.inject.Inject; | |
| import org.springframework.web.context.support.SpringBeanAutowiringSupport; | |
| import br.ufc.quixada.npi.model.Contato; | |
| import br.ufc.quixada.npi.service.ContatoService; | |
| @ManagedBean | |
| public class ContatoController2 { | |
| @Inject | |
| private ContatoService cs; | |
| public ContatoController2() { | |
| super(); | |
| SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this); | |
| } | |
| public void inserir() { | |
| try { | |
| cs.insere(); | |
| } catch (Exception e) { | |
| System.out.println("Não foi possível realizar a inserção"); | |
| } | |
| } | |
| public List<Contato> getContatos() { | |
| return cs.findAll(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment