JavaWeb-RESTful(一)_RESTful初认识  传送门

  JavaWeb-RESTful(二)_使用SpringMVC开发RESTful_上  传送门

  JavaWeb-RESTful(三)_使用SpringMVC开发RESTful_下  传送门

  项目已上传至github  传送门

  Learn

     一、实现一个成功的SpringMVC单元测试类

    二、RequestParam注解:

    三、JsonView注解

  创建SpringBoot项目  传送门

  

  【 添加Spring Web Starter,Spring Data JPA,Spring Security,Thymeleaf,Spring Data Elasticsearch,Cloud OAuth2,Spring Session,MySQL Driver,H2 Database依赖】

一、实现一个成功的SpringMVC单元测试类

  在MainController.java中向服务器以Json格式发起一个请求,并反回两个期望

  期望一:期望服务器返回状态码为200

  期望二:期望服务器返回json中的数组长度为3

        @Test
//查询user
public void test() throws Exception
{
//发起一个Get请求
mockMvc.perform(MockMvcRequestBuilders.get("/user")
//json的形式发送一个请求
.contentType(MediaType.APPLICATION_JSON_UTF8))
//期望服务器返回什么(期望返回的状态码为200)
.andExpect(MockMvcResultMatchers.status().isOk())
//期望服务器返回json中的数组长度为3
.andExpect(MockMvcResultMatchers.jsonPath("$.length()").value(3)); }

package com.Gary.GaryRESTful;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication
public class GaryResTfulApplication { public static void main(String[] args) {
SpringApplication.run(GaryResTfulApplication.class, args);
} }

GaryResTfulApplication.java

package com.Gary.GaryRESTful.controller;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext; //这是SpringBoot测试类 @RunWith(SpringRunner.class)
@SpringBootTest
public class MainController { @Autowired
private WebApplicationContext webApplicationContext; //SpringMV单元测试独立测试类
private MockMvc mockMvc; @Before
public void before()
{
//创建独立测试类
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
} @Test
//查询user
public void test() throws Exception
{
//发起一个Get请求
mockMvc.perform(MockMvcRequestBuilders.get("/user")
//json的形式发送一个请求
.contentType(MediaType.APPLICATION_JSON_UTF8))
//期望服务器返回什么(期望返回的状态码为200)
.andExpect(MockMvcResultMatchers.status().isOk())
//期望服务器返回json中的数组长度为3
.andExpect(MockMvcResultMatchers.jsonPath("$.length()").value(3)); } }

MainController.java

package com.Gary.GaryRESTful.controller;

import java.util.ArrayList;
import java.util.List; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import com.Gary.GaryRESTful.dto.User; //表示这个Controller提供R二十天API
@RestController
public class UserController { @RequestMapping(value="/user",method = RequestMethod.GET)
public List<User> query()
{
//满足期望服务器返回json中的数组长度为3
List<User> list = new ArrayList<>();
list.add(new User());
list.add(new User());
list.add(new User());
return list;
} }

UserController.java

package com.Gary.GaryRESTful.dto;

public class User {

    private String username;
private String password; public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
} }

User.java

二、RequestParam注解:

  @RequestParam 获取请求参数的值

  在MainController.java中通过param方法给Get请求添加参数

        @Test
//查询user
public void test() throws Exception
{
//发起一个Get请求
mockMvc.perform(MockMvcRequestBuilders.get("/user")
.param("username", "Gary")
//json的形式发送一个请求
.contentType(MediaType.APPLICATION_JSON_UTF8))
//期望服务器返回什么(期望返回的状态码为200)
.andExpect(MockMvcResultMatchers.status().isOk())
//期望服务器返回json中的数组长度为3
.andExpect(MockMvcResultMatchers.jsonPath("$.length()").value(3)); }

  在UserController.java中通过@RequestParam注入username参数,并通过System.out.println(username)输出username中的值

    @RequestMapping(value="/user",method = RequestMethod.GET)
/*
* default value 默认
* name 请求的名字
* required 是否是必须的,true
* value 别名
*
* */
public List<User> query(@RequestParam(name="username",required=false) String username)
{
System.out.println(username);
//满足期望服务器返回json中的数组长度为3
List<User> list = new ArrayList<>();
list.add(new User());
list.add(new User());
list.add(new User());
return list;
}

package com.Gary.GaryRESTful.controller;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext; //这是SpringBoot测试类 @RunWith(SpringRunner.class)
@SpringBootTest
public class MainController { @Autowired
private WebApplicationContext webApplicationContext; //SpringMV单元测试独立测试类
private MockMvc mockMvc; @Before
public void before()
{
//创建独立测试类
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
} @Test
//查询user
public void test() throws Exception
{
//发起一个Get请求
mockMvc.perform(MockMvcRequestBuilders.get("/user")
.param("username", "Gary")
//json的形式发送一个请求
.contentType(MediaType.APPLICATION_JSON_UTF8))
//期望服务器返回什么(期望返回的状态码为200)
.andExpect(MockMvcResultMatchers.status().isOk())
//期望服务器返回json中的数组长度为3
.andExpect(MockMvcResultMatchers.jsonPath("$.length()").value(3)); } }

MainController.java

package com.Gary.GaryRESTful.controller;

import java.util.ArrayList;
import java.util.List; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import com.Gary.GaryRESTful.dto.User; //表示这个Controller提供R二十天API
@RestController
public class UserController { @RequestMapping(value="/user",method = RequestMethod.GET)
public List<User> query(@RequestParam String username)
{
System.out.println(username);
//满足期望服务器返回json中的数组长度为3
List<User> list = new ArrayList<>();
list.add(new User());
list.add(new User());
list.add(new User());
return list;
} //@RequestParam }

UserController.java

  如果需要访问用户详细信息,在MainController.java中添加getInfo()方法,发起一个get请求去查看用户详情

        @Test
public void getInfo() throws Exception
{
//发起一个get请求,查看用户详情
mockMvc.perform(MockMvcRequestBuilders.get("/user/1")
.contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(MockMvcResultMatchers.status().isOk())
.andExpect(MockMvcResultMatchers.jsonPath("$.username").value("Gary"));
}

  在UserController.java中添加一个getInfo()方法,去接收该请求

    @RequestMapping(value="/user/{id}",method= RequestMethod.GET)
//将@PathVariable路径中的片段映射到java代码中
public User getInfo(@PathVariable String id)
{
User user = new User();
user.setUsername("Gary");
return user;
}

package com.Gary.GaryRESTful;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication
public class GaryResTfulApplication { public static void main(String[] args) {
SpringApplication.run(GaryResTfulApplication.class, args);
} }

GaryResTfulApplication.java

package com.Gary.GaryRESTful.controller;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext; //这是SpringBoot测试类 @RunWith(SpringRunner.class)
@SpringBootTest
public class MainController { @Autowired
private WebApplicationContext webApplicationContext; //SpringMV单元测试独立测试类
private MockMvc mockMvc; @Before
public void before()
{
//创建独立测试类
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
} @Test
//查询user
public void test() throws Exception
{
//发起一个Get请求
mockMvc.perform(MockMvcRequestBuilders.get("/user")
.param("username", "Gary")
//json的形式发送一个请求
.contentType(MediaType.APPLICATION_JSON_UTF8))
//期望服务器返回什么(期望返回的状态码为200)
.andExpect(MockMvcResultMatchers.status().isOk())
//期望服务器返回json中的数组长度为3
.andExpect(MockMvcResultMatchers.jsonPath("$.length()").value(3)); } @Test
public void getInfo() throws Exception
{
//发起一个get请求,查看用户详情
mockMvc.perform(MockMvcRequestBuilders.get("/user/1")
.contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(MockMvcResultMatchers.status().isOk())
.andExpect(MockMvcResultMatchers.jsonPath("$.username").value("Gary"));
}
}

MainController.java

package com.Gary.GaryRESTful.controller;

import java.util.ArrayList;
import java.util.List; import org.junit.Test;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import com.Gary.GaryRESTful.dto.User; //表示这个Controller提供R二十天API
@RestController
public class UserController { @RequestMapping(value="/user",method = RequestMethod.GET)
/*
* default value 默认
* name 请求的名字
* required 是否是必须的,true
* value 别名
*
* */
public List<User> query(@RequestParam(name="username",required=false) String username)
{
System.out.println(username);
//满足期望服务器返回json中的数组长度为3
List<User> list = new ArrayList<>();
list.add(new User());
list.add(new User());
list.add(new User());
return list;
} @RequestMapping(value="/user/{id}",method= RequestMethod.GET)
//将@PathVariable路径中的片段映射到java代码中
public User getInfo(@PathVariable String id)
{
User user = new User();
user.setUsername("Gary");
return user;
} }

UserController.java

package com.Gary.GaryRESTful.dto;

public class User {

    private String username;
private String password; public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
} }

User.java

三、JsonView注解

  @JsonView是Jackson的一个注解,可以用来过滤序列化对象的字段属性,是你可以选择序列化对象哪些属性,哪些过滤掉。

  @JsonView使用步骤:

    1、使用接口来声明多个视图

    2、在值对象的get方法上指定视图

    3、在Controller方法上指定视图

  通过.andReturn().getResponse().getContentAsString()将mockMvc.perform(MockMvcRequestBuilders.get("/user/1")发送的get请求以字符串的格式打印出来

        @Test
public void getInfo() throws Exception
{
//发起一个get请求,查看用户详情
String str = mockMvc.perform(MockMvcRequestBuilders.get("/user/1")
.contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(MockMvcResultMatchers.status().isOk())
.andExpect(MockMvcResultMatchers.jsonPath("$.username").value("Gary"))
.andReturn().getResponse().getContentAsString(); System.out.println(str); }

package com.Gary.GaryRESTful.controller;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext; //这是SpringBoot测试类 @RunWith(SpringRunner.class)
@SpringBootTest
public class MainController { @Autowired
private WebApplicationContext webApplicationContext; //SpringMV单元测试独立测试类
private MockMvc mockMvc; @Before
public void before()
{
//创建独立测试类
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
} @Test
//查询user
public void test() throws Exception
{
//发起一个Get请求
mockMvc.perform(MockMvcRequestBuilders.get("/user")
.param("username", "Gary")
//json的形式发送一个请求
.contentType(MediaType.APPLICATION_JSON_UTF8))
//期望服务器返回什么(期望返回的状态码为200)
.andExpect(MockMvcResultMatchers.status().isOk())
//期望服务器返回json中的数组长度为3
.andExpect(MockMvcResultMatchers.jsonPath("$.length()").value(3)); } @Test
public void getInfo() throws Exception
{
//发起一个get请求,查看用户详情
String str = mockMvc.perform(MockMvcRequestBuilders.get("/user/1")
.contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(MockMvcResultMatchers.status().isOk())
.andExpect(MockMvcResultMatchers.jsonPath("$.username").value("Gary"))
.andReturn().getResponse().getContentAsString(); System.out.println(str); }
}

MainController.java

  发现此时输出来的json字符串格式是{"username":"Gary","password":null},但我们此时不希望用户看到password时,就可以用到@JsonView这个注解了

  使用接口声明多个视图

    1)username,password

    2)username

  在值对象的get方法中指定视图

//简单试图 只有一个username
public interface UserSimpleView{};
//复杂试图 有username 和 password
public interface UserDetailView extends UserSimpleView{}; private String username;
private String password; @JsonView(UserSimpleView.class)
public String getUsername() {
return username;
} @JsonView(UserDetailView.class)
public String getPassword() {
return password;
}

  在controller方法中指定视图

@RequestMapping(value="/user",method = RequestMethod.GET)
/*
* default value 默认
* name 请求的名字
* required 是否是必须的,true
* value 别名
*
* */
@JsonView(User.UserSimpleView.class)
public List<User> query(@RequestParam(name="username",required=false) String username)
{
System.out.println(username);
//满足期望服务器返回json中的数组长度为3
List<User> list = new ArrayList<>();
list.add(new User());
list.add(new User());
list.add(new User());
return list; } @RequestMapping(value="/user/{id}",method= RequestMethod.GET)
//将@PathVariable路径中的片段映射到java代码中
@JsonView(User.UserDetailView.class)
public User getInfo(@PathVariable String id)
{
User user = new User();
user.setUsername("Gary");
return user;
}

package com.Gary.GaryRESTful;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication
public class GaryResTfulApplication { public static void main(String[] args) {
SpringApplication.run(GaryResTfulApplication.class, args);
} }

GaryResTfulApplication.java

package com.Gary.GaryRESTful.controller;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext; //这是SpringBoot测试类 @RunWith(SpringRunner.class)
@SpringBootTest
public class MainController { @Autowired
private WebApplicationContext webApplicationContext; //SpringMV单元测试独立测试类
private MockMvc mockMvc; @Before
public void before()
{
//创建独立测试类
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
} @Test
//查询user
public void test() throws Exception
{
//发起一个Get请求
String str = mockMvc.perform(MockMvcRequestBuilders.get("/user")
.param("username", "Gary")
//json的形式发送一个请求
.contentType(MediaType.APPLICATION_JSON_UTF8))
//期望服务器返回什么(期望返回的状态码为200)
.andExpect(MockMvcResultMatchers.status().isOk())
//期望服务器返回json中的数组长度为3
.andExpect(MockMvcResultMatchers.jsonPath("$.length()").value(3))
.andReturn().getResponse().getContentAsString(); System.out.println("查询简单试图"+str);
} @Test
public void getInfo() throws Exception
{
//发起一个get请求,查看用户详情
String str = mockMvc.perform(MockMvcRequestBuilders.get("/user/1")
.contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(MockMvcResultMatchers.status().isOk())
.andExpect(MockMvcResultMatchers.jsonPath("$.username").value("Gary"))
.andReturn().getResponse().getContentAsString(); System.out.println("查询复杂试图"+str); }
}

MainController.java

package com.Gary.GaryRESTful.controller;

import java.util.ArrayList;
import java.util.List; import org.junit.Test;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import com.Gary.GaryRESTful.dto.User;
import com.fasterxml.jackson.annotation.JsonView; //表示这个Controller提供R二十天API
@RestController
public class UserController { @RequestMapping(value="/user",method = RequestMethod.GET)
/*
* default value 默认
* name 请求的名字
* required 是否是必须的,true
* value 别名
*
* */
@JsonView(User.UserSimpleView.class)
public List<User> query(@RequestParam(name="username",required=false) String username)
{
System.out.println(username);
//满足期望服务器返回json中的数组长度为3
List<User> list = new ArrayList<>();
list.add(new User());
list.add(new User());
list.add(new User());
return list; } @RequestMapping(value="/user/{id}",method= RequestMethod.GET)
//将@PathVariable路径中的片段映射到java代码中
@JsonView(User.UserDetailView.class)
public User getInfo(@PathVariable String id)
{
User user = new User();
user.setUsername("Gary");
return user;
} }

UserController.java

package com.Gary.GaryRESTful.dto;

import com.fasterxml.jackson.annotation.JsonView;

public class User {

    //简单试图 只有一个username
public interface UserSimpleView{};
//复杂试图 有username 和 password
public interface UserDetailView extends UserSimpleView{}; private String username;
private String password; @JsonView(UserSimpleView.class)
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
} @JsonView(UserDetailView.class)
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
} }

User.java

JavaWeb-RESTful(二)_使用SpringMVC开发RESTful_上的更多相关文章

  1. JavaWeb-RESTful(三)_使用SpringMVC开发RESTful_下

    JavaWeb-RESTful(一)_RESTful初认识 传送门 JavaWeb-RESTful(二)_使用SpringMVC开发RESTful_上 传送门 JavaWeb-RESTful(三)_使 ...

  2. javaweb基础(21)_两种开发模式

    SUN公司推出JSP技术后,同时也推荐了两种web应用程序的开发模式,一种是JSP+JavaBean模式,一种是Servlet+JSP+JavaBean模式. 一.JSP+JavaBean开发模式 1 ...

  3. Appium移动自动化测试(二)--安装Android开发环境(转)

    Appium移动自动化测试(二)--安装Android开发环境 2015-06-04 17:30 by 虫师, 35299 阅读, 23 评论, 收藏, 编辑 继续Appium环境的搭建. 第二节   ...

  4. java学习笔记-JavaWeb篇二

    JavaWEB篇二 45 HttpSession概述46 HttpSession的生命周期 47 HttpSession常用方法示例48 HttpSessionURL重写 49 HttpSession ...

  5. SpringMVC开发手册

    title: SpringMvc -- 开发手册 date: 2018-11-15 22:14:22 tags: SpringMvc categories: SpringMvc #分类名 type: ...

  6. spring参数类型异常输出(二), SpringMvc参数类型转换错误输出(二)

    spring参数类型异常输出(二), SpringMvc参数类型转换错误输出(二) >>>>>>>>>>>>>>&g ...

  7. (二)Hololens Unity 开发入门 之 Hello HoloLens~

    学习源于官方文档 微软官文~ 笔记一部分是直接翻译官方文档,部分各人理解不一致的和一些比较浅显的保留英文原文 (二)Hololens Unity 开发入门 之 Hello HoloLens~ 本文主要 ...

  8. Spring-MVC开发步骤(入门配置)

    Spring-MVC开发步骤(入门配置) Step1.导包 spring-webmvc Step2.添加spring配置文件 Step3.配置DispatcherServlet 在web.xml中: ...

  9. Android高效率编码-第三方SDK详解系列(二)——Bmob后端云开发,实现登录注册,更改资料,修改密码,邮箱验证,上传,下载,推送消息,缩略图加载等功能

    Android高效率编码-第三方SDK详解系列(二)--Bmob后端云开发,实现登录注册,更改资料,修改密码,邮箱验证,上传,下载,推送消息,缩略图加载等功能 我的本意是第二篇写Mob的shareSD ...

随机推荐

  1. [C#.net]连接Oracle的几种方式

    一:通过System.Data.OracleClient(需要安装Oracle客户端并配置tnsnames.ora)1. 添加命名空间System.Data.OracleClient引用2. usin ...

  2. C#int类型 转Byte[]

    方法1:使用左移和右移 int转化为byte[]:   public  byte[] intToBytes(int value)         {             byte[] src = ...

  3. C# WPF集中引用图片等资源的路劲方式

    第一内部资源: pack://application:,,,/images/my.jpg 第二 外部程序资源: pack://SiteOfOrigin:,,,/images/my.jpg 需要将资源放 ...

  4. 动画方案 Lottie 学习(二)之实战

    代码 $('.success-info-title').append('<p class="normal_finish" id="normal_finish_ani ...

  5. C语言无法使用引用,一定要使用怎么办? ------指针的指针做参数

    #include <stdio.h> #include <stdlib.h> #include <string.h> void fun1(char** s); vo ...

  6. task service的ftp和s3同步文件后续优化方案

    1,开启多个task service服务,比如153,154,162各开启一个服务,去ftp和s3读取文件的第一步首先改文件名,比如xxxxxx_153,然后其他154和162不去处理这个文件,xxx ...

  7. 输出指令(echo指令和printf 命令)

    Shell echo命令 Shell 的 echo 指令与 PHP 的 echo 指令类似,都是用于字符串的输出.命令格式: echo string 您可以使用echo实现更复杂的输出格式控制. 1. ...

  8. EF Code First 数据迁移操作

    打开执行命令窗体 1.EF Code First创建数据库 PM> Install-Package EntityFramework 2.EF Code First数据库迁移 2.1.生成数据库 ...

  9. Spark Submit给jar包中的main函数传递参数

    1 示范 spark-submit --master xxx demo.jar "arg1" "arg2" 运行的jar包和传参放在最后,就可以了

  10. CAN总线简介:如何以编程方式控制汽车

    最近,我正与Voyage公司的朋友合作研究,以实现福特Fusion空调系统(A/C)的编程控制.目前,Voyage公司正努力打造自动驾驶的终极目标:能够以低廉的价格成本和广泛的投放范围,把世界任何地方 ...