增加 spring cloud 用例
This commit is contained in:
@ -17,7 +17,7 @@ import java.util.Date;
|
||||
public class Product implements Serializable {
|
||||
|
||||
// 产品序列号
|
||||
private int id;
|
||||
private long id;
|
||||
|
||||
// 产品名称
|
||||
private String name;
|
||||
|
@ -1,8 +1,7 @@
|
||||
package com.heibaiying.common.feign;
|
||||
|
||||
import com.heibaiying.common.bean.Product;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -12,13 +11,17 @@ import java.util.List;
|
||||
*/
|
||||
public interface ProductFeign {
|
||||
|
||||
@RequestMapping("products")
|
||||
@GetMapping("products")
|
||||
List<Product> productList();
|
||||
|
||||
/**
|
||||
* 这是需要强调的是使用feign时候@PathVariable一定要用value指明参数,
|
||||
* 不然会抛出.IllegalStateException: PathVariable annotation was empty on param 异常
|
||||
*/
|
||||
@RequestMapping("product/{id}")
|
||||
@GetMapping("product/{id}")
|
||||
Product productDetail(@PathVariable(value = "id") int id);
|
||||
|
||||
|
||||
@PostMapping("product")
|
||||
void save(@RequestBody Product product);
|
||||
}
|
||||
|
Reference in New Issue
Block a user