- 博客(7)
- 收藏
- 关注
原创 自定义异常
public class HrWrapException extends RuntimeException { private static final long serialVersionUID = 1L; private int errorCode; private String msg; public HrWrapException(int errorCode, String msg) { super(msg); this.er.
2021-11-17 18:19:09 82
原创 feign调用拦截器
@Configurationpublic class TrackerFeignRequestInterceptor implements RequestInterceptor { @Override public void apply(RequestTemplate requestTemplate) { if (StringUtils.isBlank(traceId)) { traceId = TraceIdUtils.nextTraceIdHi.
2021-11-10 17:24:13 354
原创 springboot全局异常处理
@ControllerAdvice@ResponseBody@Slf4jpublic class GlobalExceptionHandler { @ExceptionHandler(value = Exception.class) public Result<?> exceptionHandler(HttpServletRequest request, Exception e) { Result<?> result = new Result&.
2021-10-14 09:50:48 100
原创 springboot配置redisTemplate
@Configurationpublic class RedisConfig { @Bean public RedisTemplate<String, Object> template(RedisConnectionFactory factory) { // 创建RedisTemplate<String, Object>对象 RedisTemplate<String, Object> template = new Re.
2021-10-14 09:47:51 900
原创 springboot如何配置跨域
@Configurationpublic class CorsConfig { private CorsConfiguration buildConfig(){ CorsConfiguration corsConfiguration = new CorsConfiguration(); corsConfiguration.addAllowedOrigin("*"); corsConfiguration.addAllowedMethod("*").
2021-10-14 09:46:37 111
原创 springboot线程池配置核心参数
@Configuration@EnableAsyncpublic class TaskExecutorConfig { @Bean public TaskExecutor taskExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); // 设置核心线程数 executor.setCorePoolSize(10); // .
2021-10-14 09:45:38 953
原创 springboot全局定义null字段返回和中文乱码处理
@Configuration@ComponentScan(value = {"com.echronos.*.controller"}, includeFilters = {@ComponentScan.Filter(type = FilterType.ANNOTATION, value = Controller.class)})public class WebConfig extends WebMvcAutoConfiguration { @Bean public F.
2021-10-14 09:37:37 334
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人