@Consumes @Produces分别表示入参和出参数吗

可以这样讲。但是不是很到位。
是限定作用,类似于filter
consumes: 指定处理请求的提交内容类型(Content-Type),例如application/json, text/html;
produces: 指定返回的内容类型,仅当request请求头中的(Accept)类型中包含该指定类型才返回;


Elastic-Job——分布式定时任务框架

spring boot中使用@SpringBootApplication指定类为应用启动类,

自动扫描于当前类同级以及子包下的相应注解注册为spring beans,

在类中main方法中通过SpringApplication的run方法启动应用。

eg:

  1.  
    package com.lanhuigu;
  2.  
     
  3.  
    import org.springframework.boot.SpringApplication;
  4.  
    import org.springframework.boot.autoconfigure.SpringBootApplication;
  5.  
     
  6.  
    @SpringBootApplication
  7.  
    public class SpringBootApp {
  8.  
    public static void main( String[] args ) {
  9.  
    SpringApplication.run(SpringBootApp.class, args);
  10.  
    }
  11.  
    }

使用@SpringBootApplication注解,等价于同时使用@Configuration @EnableAutoConfiguration @ComponentScan

这三个注解的默认属性,同时,使用@SpringBootApplication也可以接合使用@EnableAutoConfiguration @ComponentScan。

其中@ComponentScan很有用,可以通过该注解指定扫描某些包下包含如下注解的均自动注册为spring beans:

@Component, @Service, @Repository, @Controller,@Entity等等。

eg:

  1.  
    package com.lanhuigu;
  2.  
     
  3.  
    import org.springframework.boot.SpringApplication;
  4.  
    import org.springframework.boot.autoconfigure.SpringBootApplication;
  5.  
    import org.springframework.context.annotation.ComponentScan;
  6.  
     
  7.  
    @SpringBootApplication
  8.  
    @ComponentScan(basePackages = {"com.lanhuigu","com.ghg"})// string[]
  9.  
    public class SpringBootApp {
  10.  
     
  11.  
    public static void main( String[] args ) {
  12.  
    SpringApplication.run(SpringBootApp.class, args);
  13.  
    }
  14.  
    }

1.什么是API网关?

API网关是一个轻量的java http 接口组件,可无缝将普通的 Serive 方法转换成 http 接口。并从已下几点来达到提高开发效率与接口质量的目的。

  1. 去掉mvc控制器,将http请求直接无缝接入JAVA服务接口
  2. 统一出入参格式
  3. 统一异常规范
  4. 自动检测服务接口规范

@BeanParam

如果传递的参数较多,可以自己写个bean,bean中的字段使用@PathParam、@QueryParam、@FormParam、@FormDataParam、@MatrixParam、@HeaderParam、@CookieParam来注解。而在resouces中具体方法参数中就可以使用@BeanParam来注解这个自定义的bean

201808_summary的更多相关文章

随机推荐

  1. WebSocket的Tomcat实现

    一.WebSocket简单介绍 随着互联网的发展,传统的HTTP协议已经很难满足Web应用日益复杂的需求了.近年来,随着HTML5的诞生,WebSocket协议被提出,它实现了浏览器与服务器的全双工通 ...

  2. BSUIR Open Finals

    A. Game with chocolates 因为差值必须是$P$的幂,故首先可以$O(\log n)$枚举出先手第一步所有取法,判断之后的游戏是否先手必败. 对于判断,首先特判非法的情况,并假设$ ...

  3. VUE重修01

    ---恢复内容开始--- 1.框架与库的区别 前端框架与库的区别? jquery 库 -> DOM(操作DOM) + 请求 art-template 库 -> 模板引擎 框架 = 全方位功 ...

  4. (75)Wangdao.com第十三天_JavaScript 包装对象

    包装对象 所谓“包装对象”,就是分别与数值.字符串.布尔值相对应的Number.String.Boolean三个原生对象 这三个原生对象可以把原始类型的值变成(包装成)对象 var v1 = new ...

  5. mobile_轮播图_style_left 版本

    mobile 轮播图 小圆点逻辑(排他) 1. 统一给所有 span 元素加 class=""; 2. 切换到谁,谁的 class="active"; 移动端轮 ...

  6. Solve Error: "errcode": 48001, "errmsg": "api unauthorized hint"

    当你想给微信公众号(不是测试账号)自定义菜单创建接口,遇到如下错误: OK Connection: keep-alive Date: Sat, 01 Dec 2018 05:02:08 GMT Con ...

  7. ng7 设置http proxy

    看文档 proxy.conf.json { "/api": { "target": "http://localhost:5000", &qu ...

  8. Educational Codeforces Round 5

    616A - Comparing Two Long Integers    20171121 直接暴力莽就好了...没什么好说的 #include<stdlib.h> #include&l ...

  9. Jmeter应用-接口测试

    1.BS架构应用性能 2.HTTP协议接口功能与性能 3.FTP协议接口功能与性能 4.Mysql数据库性能 5.MongoDB数据库性能 6.支持自定义Java组件开发 测试计划-右键-添加线程组 ...

  10. apt-get安装mysql

    1,检查是否已安装. 2,安装: apt-get install mysql-client-core-5.5 apt-get install mysql-server mysql-client 安装过 ...