From 8b02c916fec8819f4f1b27b21a26cca6c41b5f5d Mon Sep 17 00:00:00 2001 From: cloudroam <cloudroam> Date: 星期一, 14 七月 2025 09:54:05 +0800 Subject: [PATCH] add:定时任务配置,热门城市 --- src/main/java/com/mzl/flower/config/RestTemplateConfig.java | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/mzl/flower/config/RestTemplateConfig.java b/src/main/java/com/mzl/flower/config/RestTemplateConfig.java new file mode 100644 index 0000000..fcb6bb8 --- /dev/null +++ b/src/main/java/com/mzl/flower/config/RestTemplateConfig.java @@ -0,0 +1,21 @@ +package com.mzl.flower.config; + + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.client.RestTemplate; + +@Configuration +public class RestTemplateConfig { + + @Bean + public RestTemplate restTemplate() { + RestTemplate restTemplate = new RestTemplate(); + + // 可选:添加自定义配置 + // restTemplate.setErrorHandler(new CustomErrorHandler()); + // restTemplate.getMessageConverters().add(0, new StringHttpMessageConverter(StandardCharsets.UTF_8)); + + return restTemplate; + } +} -- Gitblit v1.9.3