Whitelabel Error Page
This application has no explicit mapping for / error, so you are seeing this as a fallback.
Mon Dec 19 12:32:45 EST 2016
There was an unexpected error (type = Not Found, status = 404).
No message available
OfficialClass
publicclassFuncionarioimplementsSerializable{privatestaticfinallongserialVersionUID=1L;privateIntegercodigo;privateStringnome;privateStringcargo;privateIntegeridade;privateDepartamentodepartamento;publicFuncionario(){super();}//getteresettersomitidos
Challenge2Application.java
@SpringBootApplicationpublicclassDesafio2Application{publicstaticvoidmain(String[]args){SpringApplication.run(Desafio2Application.class,args);}}
ServletInitializer
publicclassServletInitializerextendsSpringBootServletInitializer{@OverrideprotectedSpringApplicationBuilderconfigure(SpringApplicationBuilderapplication){returnapplication.sources(Desafio2Application.class);}}
OfficialDaoImpl
@RepositorypublicclassFuncionarioDaoImplimplementsFuncionarioDao{@AutowiredprivateJdbcTemplateJdbcTemplate;@OverridepublicList<Map<String,Object>>findAll(){returnJdbcTemplate.queryForList("select * from Funcionario");
}
}
OfficialController
@RestController
public class FuncionarioController {
@Autowired
FuncionarioService funcionarioService;
@RequestMapping("/funcionarios")
public List<Map<String, Object>> findAll(){
return funcionarioService.findAll();
}
}
OfficialServiceImpl
@Service
public class FuncionarioServiceImpl implements FuncionarioService{
@Autowired
private FuncionarioDao funcionarioDao;
@Override
public List<Map<String, Object>> findAll() {
return this.funcionarioDao.findAll();
}
}
I'm starting now with Spring and I do not have much expirience ... I already looked for some solutions but I could not solve the problem that is to show on the screen via url to list of officials .. Thanks in advance.