1.天气预报系统
- 数据来源 http://wthrcdn等开放的接口
查看天气
- 访问:http://wthrcdn.etouch.cn/weather_mini?citykey=101280601
- 访问:http://wthrcdn.etouch.cn/weather_mini?city=杭州
但是用API工具返回是正常的:http://apizza.cc
- 自身访问:http://localhost:8080/weather/cityId/101282004
2.使用redis提高响应能力
- 及时响应,减少服务调用
- 开发环境:JDK9+ ,Apache HttpClient4.5.3,Redis3.2.100,Spring Boot Web Starter,Spring Boot Data Redis Starter
- pom添加spring-boot-starter-data-redis
- 先取缓存中的数据
“`aidl
private WeatherResponse doGetWeahter(String uri) {
String key = uri;
String strBody = null;
ObjectMapper mapper = n