package com.tax.zone.startup;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients(basePackages = {"com.tax.zone"}) // 开启Feign支持
@ComponentScan(basePackages = {"com.tax.zone","com.yxcheng.token"})
public class ZoneStartupApplication
{
    
	// 启动的时候要注意，由于我们在controller中注入了RestTemplate，所以启动的时候需要实例化该类的一个实例 
    @Autowired 
    private RestTemplateBuilder builder;
   
    // 使用RestTemplateBuilder来实例化RestTemplate对象，spring默认已经注入了RestTemplateBuilder实例 
    @Bean 
    public RestTemplate restTemplate() { 
        return builder.build(); 
    }  
	
    public static void main(String[] args)
    {
        SpringApplication.run(ZoneStartupApplication.class, args);
    }
}
