content: package com.alibabacloud.hipstershop;
  
  import java.io.File;
  import java.io.FileReader;
  import java.io.IOException;
  import java.util.Properties;
  
  import com.alibabacloud.hipstershop.common.MyRule;
  import com.netflix.loadbalancer.IRule;
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  import org.springframework.cloud.client.loadbalancer.LoadBalanced;
  import org.springframework.cloud.openfeign.EnableFeignClients;
  import org.springframework.context.annotation.Bean;
  import org.springframework.web.client.RestTemplate;
  
  @EnableFeignClients
  @SpringBootApplication
  public class Application {
      public static void main(String[] args) {
          SpringApplication.run(Application.class, args);
      }
  
      @Bean
      @LoadBalanced
      public RestTemplate restTemplate() {
          return new RestTemplate();
      }
  
      public static String SERVICE_TAG;
      public static String APP_NAME = System.getProperty("mse.appName","nil");
  
      static {
  
          try {
              File file = new File("/etc/podinfo/labels");
              if (file.exists()) {
  
                  Properties properties = new Properties();
                  FileReader fr = null;
                  try {
                      fr = new FileReader(file);
                      properties.load(fr);
                  } catch (IOException e) {
                  } finally {
                      if (fr != null) {
                          try {
                              fr.close();
                          } catch (Throwable ignore) {}
                      }
                  }
                  SERVICE_TAG = properties.getProperty("alicloud.service.tag").replace("\"", "");
              } else {
                  SERVICE_TAG = "nil";
              }
          } catch (Throwable ignore) {}
      }
  
      @Bean
      public IRule iRule(){
          return new MyRule();
      }
  }
  