|
@ -5,7 +5,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
|
import org.springframework.boot.web.support.SpringBootServletInitializer;
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
|
|
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
|
|
|
import org.springframework.scheduling.annotation.EnableAsync;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
@ -31,7 +30,6 @@ public class SvrCloudDeviceApplication extends SpringBootServletInitializer {
|
|
|
return builder.sources(SvrCloudDeviceApplication.class);
|
|
|
}
|
|
|
|
|
|
@LoadBalanced//为RestTemplate Bean添加了一个LoadBalancerInterceptor拦截器。可以将请求的地址中的服务逻辑名转为具体的服务地址
|
|
|
@Bean//将RestTemplate注册到容器
|
|
|
public RestTemplate RestTemplate(){
|
|
|
return new RestTemplate();
|