com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.BlockExceptionHandler Java Examples
The following examples show how to use
com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.BlockExceptionHandler.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SentinelAutoConfigure.java From microservices-platform with Apache License 2.0 | 5 votes |
@Bean public BlockExceptionHandler blockExceptionHandler() { return (request, response, e) -> { response.setStatus(429); Result result = Result.failed(e.getMessage()); response.getWriter().print(JSONUtil.toJsonStr(result)); }; }
Example #2
Source File: BaseWebMvcConfig.java From Sentinel with Apache License 2.0 | 4 votes |
public BlockExceptionHandler getBlockExceptionHandler() { return blockExceptionHandler; }
Example #3
Source File: BaseWebMvcConfig.java From Sentinel with Apache License 2.0 | 4 votes |
public void setBlockExceptionHandler(BlockExceptionHandler blockExceptionHandler) { this.blockExceptionHandler = blockExceptionHandler; }
Example #4
Source File: SentinelBeanAutowiredTests.java From spring-cloud-alibaba with Apache License 2.0 | 4 votes |
@Bean public BlockExceptionHandler blockExceptionHandler() { return new DefaultBlockExceptionHandler(); }