Skip to content

Commit

Permalink
*support springboot3
Browse files Browse the repository at this point in the history
Signed-off-by: provenceee <[email protected]>
  • Loading branch information
provenceee committed Nov 12, 2024
1 parent 6631673 commit 4af5fc8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package com.huaweicloud.spring.rest.consumer;

import com.huaweicloud.spring.common.flowcontrol.handlers.RestTemplateResponseErrorHandler;

import org.apache.http.client.config.RequestConfig;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
Expand Down Expand Up @@ -63,7 +65,9 @@ public class FlowcontrolConiguration {
@LoadBalanced
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
RestTemplate restTemplate = new RestTemplate();
restTemplate.setErrorHandler(new RestTemplateResponseErrorHandler());
return restTemplate;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

package com.huaweicloud.spring.common.flowcontrol.consumer;

import com.huaweicloud.spring.common.flowcontrol.handlers.RestTemplateResponseErrorHandler;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -31,8 +29,6 @@
import java.util.Locale;
import java.util.UUID;

import javax.annotation.PostConstruct;

/**
* 基于Client端的治理测试
*
Expand All @@ -51,14 +47,6 @@ public class ClientController {
@Autowired
private RestTemplate restTemplate;

/**
* 初始化
*/
@PostConstruct
public void init() {
restTemplate.setErrorHandler(new RestTemplateResponseErrorHandler());
}

/**
* 实例隔离接口测试
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

package com.huaweicloud.spring.common.flowcontrol.consumer;

import com.huaweicloud.spring.common.flowcontrol.handlers.RestTemplateResponseErrorHandler;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
Expand All @@ -33,8 +31,6 @@

import java.util.Locale;

import javax.annotation.PostConstruct;

/**
* 流控服务端测试
*
Expand All @@ -54,14 +50,6 @@ public class ServerController {
@Autowired
private RestTemplate restTemplate;

/**
* 初始化
*/
@PostConstruct
public void init() {
restTemplate.setErrorHandler(new RestTemplateResponseErrorHandler());
}

/**
* 限流测试
*
Expand Down

0 comments on commit 4af5fc8

Please sign in to comment.