package demo.helloconsumer;

import demo.hellocommon.Name;
import demo.hellocommon.Result;
import demo.hellocommon.User;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClient;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

@FeignClient(value="${provider.name}",path="/user",
             configuration = HelloFeignConfig.class,
             //fallback = HelloFeignFallback.class
             fallbackFactory = HelloFeignFallbackFactory.class
             )
public interface HelloFeignService {
    @GetMapping(value = "/greet/{username}")
    String sayHello(@PathVariable("username") String username);

    default String sayHello() {
      return sayHello("Stranger");
    }

    @GetMapping(value = "/testname")
    Result testName(@SpringQueryMap Name name);

    @PostMapping(value = "/testuser")
    Result testUser(@RequestBody User user);

}


/*********************************************************
 * 作者：孙卫琴                                   
 * 来源：《Spring Cloud Alibaba微服务开发零基础入门到实战》源代码  
 * 技术支持网址：www.javathinker.net/alibaba                    
 *********************************************************/
