ICode9

精准搜索请尝试: 精确搜索
  • Spring-全局异常处理-@RestControllerAdvice2021-10-26 17:00:42

    @RestControllerAdvice是复合注解 @ControllerAdvice @ResponseBody import org.springframework.web.bind.annotation.RestControllerAdvice; 作用:对Controller进行增强,两者搭配,常做全局异常处理 @ControllerAdvice 作用在类上,有三种用法 全局异常处理: @ModelAttribute 全局数

  • SpringBoot 基础10 Elasticsearch2021-06-06 21:58:02

    什么是ElasticSearch ?     基于Lucene的搜索服务器,常被当做一个文档型 NoSQL 数据库在使用 ​     Elasticsearch是用Java语言开发的,并作为Apache许可条款下的开放源码发布,是一种流行的企业级搜索引擎 ​     默认端口:9200 ​ 使用 Elastic Search有什么好处? Elasti

  • RestTemplate2021-04-17 15:00:02

    一. 什么是RestTemplate 传统情况下在java代码里访问restful服务,一般使用Apache的HttpClient。不过此种方法使用起来太过繁琐。spring提供了一种简单便捷的模板类来进行操作,这就是RestTemplate。 二.一个简单的例子。 定义一个简单的restful接口 @RestController public clas

  • RestTemplate2020-07-09 10:01:36

    RestTemplate是什么? 传统情况下在java代码里访问restful服务,一般使用Apache的HttpClient。不过此种方法使用起来太过繁琐。spring提供了一种简单便捷的模板类来进行操作,这就是RestTemplate。 它简化了与http服务的通信方式,统一了restful的标准,封装了http链接, 我们只需要传入url及

  • kotlin泛型类、泛型接口2019-06-27 15:00:54

    示例代码 /** * 定义一个泛型类 */ abstract class BaseResponseBean<T> { var code: Int = 0 var msg: String? = null var data: T? = null override fun toString(): String { return "code=$code msg=$msg data=$data" } } /** * 定

  • springboot统一restful返回值及统一异常处理2019-04-09 17:55:40

    统一返回restful数据: 首先确定需要返回的json数据的格式,定义一个统一返回类 package com.unicom.microservice.peixun.peixun_matb3.Response; import com.unicom.microservice.peixun.peixun_matb3.enums.UnicomResponseEnums; /** @program: 测试 @description:返回的JSON数

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有