All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.envision.core.MarsExceptionControllerAdvice Maven / Gradle / Ivy

The newest version!
package com.envision.core;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;


/**
 * @author qiweishi
 * @date 2018/11/13
 */
@ControllerAdvice
public class MarsExceptionControllerAdvice {

    @SuppressWarnings("unchecked")
    @ExceptionHandler(AccessDeniedException.class)
    public  ResponseEntity exception(AccessDeniedException exception) {
        //error
        return new ResponseEntity(exception, HttpStatus.UNAUTHORIZED);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy