美丽心灵公益论坛

查看: 436|回复: 0

写了一个天气功能的demo:

[复制链接]
累计签到:534 天
连续签到:1 天

887

主题

3114

回帖

4万

积分

版主

Rank: 7Rank: 7Rank: 7

积分
48404
发表于 2024-12-17 19:45:25| 字数 496 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

x
别的就不秀了,直接上核心


  1. package com.example.weather;

  2. import org.springframework.cloud.openfeign.FeignClient;
  3. import org.springframework.web.bind.annotation.GetMapping;
  4. import org.springframework.web.bind.annotation.RequestParam;

  5. @FeignClient(name = "weatherClient", url = "https://api.openweathermap.org/data/2.5")
  6. public interface WeatherClient {

  7.     @GetMapping("/weather")
  8.     WeatherResponse getWeather(@RequestParam("q") String city,
  9.                                 @RequestParam("appid") String apiKey);
  10. }
复制代码


请各位大佬,斧正!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|免责及版权声明|关于|美丽心灵公益论坛

GMT+8, 2025-9-21 05:11 , Processed in 0.037365 second(s), 26 queries .

Powered by Discuz! X3.4

!copyright!

快速回复 返回顶部 返回列表