legs+ 发表于 2024-12-17 19:45:25

写了一个天气功能的demo:

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


package com.example.weather;

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

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

    @GetMapping("/weather")
    WeatherResponse getWeather(@RequestParam("q") String city,
                              @RequestParam("appid") String apiKey);
}

请各位大佬,斧正!
页: [1]
查看完整版本: 写了一个天气功能的demo: