WeatherController.java
726 Bytes
package com.viontech.controller;
import com.viontech.service.impl.WeatherService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.io.IOException;
/**
* @author HlQ
* @date 2021/8/4
*/
@RestController
public class WeatherController {
@Resource
private WeatherService weatherService;
@GetMapping("/getWeather")
public Object get() {
System.out.println("手动调用,获取今天的天气!");
try {
weatherService.getWeatherInfo();
} catch (IOException e) {
e.printStackTrace();
}
return "手动调用成功";
}
}