From 4de4e1fcb38028c4b18d45c68705a107945c3736 Mon Sep 17 00:00:00 2001 From: whyclxw <810412026@qq.com> Date: 星期三, 09 十月 2024 10:36:27 +0800 Subject: [PATCH] 修改restemlate --- src/main/java/com/whyc/LithiumBmsApplication.java | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/whyc/LithiumBmsApplication.java b/src/main/java/com/whyc/LithiumBmsApplication.java index f9c0798..36abf1e 100644 --- a/src/main/java/com/whyc/LithiumBmsApplication.java +++ b/src/main/java/com/whyc/LithiumBmsApplication.java @@ -3,12 +3,22 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.servlet.ServletComponentScan; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Scope; +import org.springframework.web.client.RestTemplate; import org.springframework.web.servlet.config.annotation.EnableWebMvc; @EnableWebMvc @SpringBootApplication @ServletComponentScan(basePackages = {"com.whyc.filter"}) public class LithiumBmsApplication { + + @Bean + @Scope("prototype") + public RestTemplate restTemplate() { + return new RestTemplate(); + } + public static void main(String[] args) { SpringApplication.run(LithiumBmsApplication.class, args); } -- Gitblit v1.9.1