jeesite icon indicating copy to clipboard operation
jeesite copied to clipboard

jeesite平台是如何处理系统中的异常的?

Open sheldonshen opened this issue 9 years ago • 3 comments

如题,研究了半天,也没有看出来,jeesite是如何对系统的异常是如何做出统一处理的.希望知道的,能指点一下.

sheldonshen avatar Apr 28 '17 07:04 sheldonshen

看spring-mvc.xml 里面的这段

<bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
		<property name="exceptionMappings">
			<props>
				<prop key="org.apache.shiro.authz.UnauthorizedException">error/403</prop>
				<prop key="java.lang.Throwable">error/500</prop>
			</props>
			</property>
	</bean>

irongroup avatar Apr 28 '17 07:04 irongroup

那可以把BaseController里的

/**
 * 参数绑定异常
 */
@ExceptionHandler({BindException.class, ConstraintViolationException.class, ValidationException.class})
public String bindException() {  
    return "error/400";
}

/**
 * 授权登录异常
 */
@ExceptionHandler({AuthenticationException.class})
public String authenticationException() {  
    return "error/403";
}

也写到spring-mvc.xml里了,方便统一管理。

javyuan avatar Apr 28 '17 09:04 javyuan

@irongroup , @javyuan ,多谢.:smile:

sheldonshen avatar May 03 '17 10:05 sheldonshen