Feign自动拼接请求的URL

@FeignClient("user-service")

public interface UserFeignClient {

   @GetMapping(value="/user/{id}",headers={"Authorization=qwer"})
   User queryUserById(@PathVariable("id") Long id);
}

 

@Service
public class UserService {

   @Autowired
   private UserFeignClient userFeignClient;

   public List<User> queryUserByIds(List<Long> ids) {
   List<User> users = new ArrayList<>();
   ids.forEach(id -> {
     users.add(this.userFeignClient.queryUserById(id));
   });
   return users;
  }
}

posted @ 2020-09-04 12:51  枫树湾河桥  阅读(2087)  评论(0编辑  收藏  举报
Live2D