写了一个天气功能的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]