1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

example annotations clearer

This commit is contained in:
赵禹光
2019-08-23 15:36:31 +08:00
parent 00835121cb
commit 3eb75988e3
16 changed files with 53 additions and 67 deletions

View File

@@ -21,6 +21,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
@@ -54,7 +55,7 @@ public class BusinessApplication {
@FeignClient(value = "order", url = "http://127.0.0.1:18083")
public interface OrderService {
@RequestMapping(path = "/order", method = RequestMethod.POST)
@PostMapping(path = "/order")
String order(@RequestParam("userId") String userId,
@RequestParam("commodityCode") String commodityCode,
@RequestParam("orderCount") int orderCount);

View File

@@ -24,6 +24,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@@ -60,7 +61,7 @@ public class HomeController {
}
@GlobalTransactional(timeoutMills = 300000, name = "spring-cloud-demo-tx")
@RequestMapping(value = "/seata/rest", method = RequestMethod.GET, produces = "application/json")
@GetMapping(value = "/seata/rest", produces = "application/json")
public String rest() {
String result = restTemplate.getForObject(