404 Whitelabel Error Page

0

I'm practicing with Spring JPA. I have the following code

@Controller
@RequestMapping("/empleados")
public class EmpleadoController {

    @Autowired
    @Qualifier("empleadoRepository")
    private EmpleadoRepository empleadoRepository;

    @GetMapping("/listarempleados")
    public ModelAndView listarEmpleados() {

        ModelAndView mav = new ModelAndView("listaempleados");
        mav.addObject("empleados", empleadoRepository.findEmpleadoByAge());
        return mav;

    }
}

Inside my src / main / resources folder I have a templates folder with the name employeelist.html but when accessing the url link throws me that can not find the page.

Have I misconfigured my ModelAndView?

    
asked by Lucas. D 21.01.2018 в 20:13
source

1 answer

0

In my main class, where the @SpringBootApplication tag is located, add the following @ComponentScan (basePackages = {"com.example"}) and now it works.

    
answered by 21.01.2018 / 20:51
source