瀏覽代碼

优化api 无法调用问题

java110 6 年之前
父節點
當前提交
79ba00e78e
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. 4 3
      FrontService/src/main/java/com/java110/front/FrontServiceApplicationStart.java

+ 4 - 3
FrontService/src/main/java/com/java110/front/FrontServiceApplicationStart.java

@@ -9,6 +9,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
 import org.springframework.boot.web.client.RestTemplateBuilder;
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.client.loadbalancer.LoadBalanced;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.annotation.Bean;
 import org.springframework.http.converter.StringHttpMessageConverter;
@@ -49,7 +50,7 @@ public class FrontServiceApplicationStart {
      * @return restTemplate
      */
     @Bean
-    //@LoadBalanced
+    @LoadBalanced
     public RestTemplate restTemplate() {
         StringHttpMessageConverter m = new StringHttpMessageConverter(Charset.forName("UTF-8"));
         RestTemplate restTemplate = new RestTemplateBuilder().additionalMessageConverters(m).build();
@@ -62,8 +63,8 @@ public class FrontServiceApplicationStart {
             ApplicationContext context = SpringApplication.run(FrontServiceApplicationStart.class, args);
             ServiceStartInit.initSystemConfig(context);
             //VueComponentTemplate.initComponent(VueComponentTemplate.DEFAULT_COMPONENT_PACKAGE_PATH);
-        }catch (Throwable e){
-            logger.error("系统启动失败",e);
+        } catch (Throwable e) {
+            logger.error("系统启动失败", e);
         }
     }
 }