1
0

2 Коммиты c0595f2efd ... 12af17fec9

Автор SHA1 Сообщение Дата
  林仔 12af17fec9 Merge remote-tracking branch 'origin/master' 4 дней назад
  林仔 3817409f96 feat(services): 在多个服务中启用调度功能并添加RestTemplate配置 4 дней назад

+ 2 - 0
audio-service/src/main/java/com/zksy/audio/AudioApplication.java

@@ -4,7 +4,9 @@ package com.zksy.audio;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableScheduling;
 
+@EnableScheduling
 @MapperScan(basePackages = "com.zksy.audio.mapper")
 @SpringBootApplication(scanBasePackages = {"com.zksy.audio","com.zksy.api"})
 public class AudioApplication {

+ 16 - 0
audio-service/src/main/java/com/zksy/audio/config/RestTemplateConfig.java

@@ -0,0 +1,16 @@
+package com.zksy.audio.config;
+
+import org.springframework.cloud.client.loadbalancer.LoadBalanced;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.RestTemplate;
+
+@Configuration
+public class RestTemplateConfig {
+
+    @Bean
+    @LoadBalanced
+    public RestTemplate restTemplate() {
+        return new RestTemplate();
+    }
+}

+ 1 - 0
manhole-service/src/main/java/com/zksy/manhole/utils/MessageHandler.java

@@ -12,6 +12,7 @@ import io.netty.handler.timeout.ReadTimeoutException;
 import lombok.extern.slf4j.Slf4j;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.Date;

+ 2 - 0
telemetry-service/src/main/java/com/zksy/telemetry/TelemetryApplication.java

@@ -4,7 +4,9 @@ package com.zksy.telemetry;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableScheduling;
 
+@EnableScheduling
 @MapperScan({
         "com.zksy.telemetry.mapper",
         "com.zksy.base.mapper",

+ 16 - 0
telemetry-service/src/main/java/com/zksy/telemetry/config/RestTemplateConfig.java

@@ -0,0 +1,16 @@
+package com.zksy.telemetry.config;
+
+import org.springframework.cloud.client.loadbalancer.LoadBalanced;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.RestTemplate;
+
+@Configuration
+public class RestTemplateConfig {
+
+    @Bean
+    @LoadBalanced
+    public RestTemplate restTemplate() {
+        return new RestTemplate();
+    }
+}