@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. 遍历文件路径python版,java版

    python: # 获取所有txt路径列表 file_list = [] def gci(filepath): files=os.listdir(filepath) for fi in files: ...

  2. 多台CentOS服务器下实现SSH免密码登录

    ROOT用户下实现SSH免密码登录 第一步:进入目录/root/.ssh $ cd  /root/.ssh/ 执行以下命令,会在当前目录下生成公钥(id_rsa.pub)/私钥(id_rsa)对 第二 ...

  3. Android 常见问题解决

    1.Android 启动Activity后阻止EditText自动获取焦点 在EditText中添加如下属性即可 <LinearLayout android:focusable="tr ...

  4. Beta(3/7)

    鐵鍋燉腯鱻 项目:小鱼记账 团队成员 项目燃尽图 冲刺情况描述 站立式会议照片 各成员情况 团队成员 学号 姓名 git地址 博客地址 031602240 许郁杨 (组长) https://githu ...

  5. day13_DOM

    一,document可以获得HTML页面全部内容, 1.①document.getElementById:获取全部id标签,②document.getElementById("i1" ...

  6. c++模板文件,方便调试与运行时间的观察

    #define _CRT_SECURE_NO_WARNINGS#include<iostream>#include <vector>#include<algorithm& ...

  7. python学习:输入中文

    输入中文 python2 输入中文:#!-*- coding:utf-8 -*-(或者#coding:utf-8)例如: msg = u"我爱北京天安门!" print msg p ...

  8. Codechef August Challenge 2018 : Lonely Cycles

    传送门 几波树形dp就行了. #include<cstdio> #include<cstring> #include<algorithm> #define MN 5 ...

  9. css3 属性

    1.css 面试题: css 组成: css 样式组成 规则:选择器+声明块 声明块:css属性+css属性值 2.css 解析规则: 从右往左 3.文字超出省略号显示: 1.元素不是内联块 2.ov ...

  10. JAVA新的一天

    在2019/03/22/今天里,荣幸成为这个班级的一员,认识了新的小伙伴们,上午由老师大体说了一下java的理念,下午安装了DW编辑器,以及讲解了HTML的基本构造,和标签的使用,即使以前学习过,这次 ...