@Controller
public class MyErrorController implements ErrorController {
private UserService userService;
@Autowired
public MyErrorController(UserService userService)
{
this.userService = userService;
}
@RequestMapping("/error")
public ModelAndView handleError(ModelAndView modelAndView, HttpServletRequest request, Authentication authentication, RedirectAttributes redirectAttributes) {
Object status = request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);
if(status != null)
{
[...]
Hej.
Mam problem. We wszystkich kontrolerach z Authentication authentication, po zalogowaniu zmienna nie jest nullem.
W kontrolerze MyErrorController jest nullem mimo że wcześniej się logowałem.
Jak temu zapobiec?