fix(tenant): select update config client constructor
这个提交包含在:
父节点
d226936d78
当前提交
297a94a3e4
@ -8,6 +8,7 @@ import java.util.Map;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -27,6 +28,7 @@ public class UpdatePublishConfigClient {
|
|||||||
private final Duration cacheTtl;
|
private final Duration cacheTtl;
|
||||||
private final Map<String, CachedRequirement> cache = new ConcurrentHashMap<>();
|
private final Map<String, CachedRequirement> cache = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
@Autowired
|
||||||
public UpdatePublishConfigClient(
|
public UpdatePublishConfigClient(
|
||||||
ObjectMapper objectMapper,
|
ObjectMapper objectMapper,
|
||||||
RestTemplateBuilder restTemplateBuilder,
|
RestTemplateBuilder restTemplateBuilder,
|
||||||
|
|||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.xuqm.tenant.service;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||||
|
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||||
|
|
||||||
|
class UpdatePublishConfigClientContextTest {
|
||||||
|
|
||||||
|
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||||
|
.withBean(ObjectMapper.class)
|
||||||
|
.withBean(RestTemplateBuilder.class)
|
||||||
|
.withBean(UpdatePublishConfigClient.class);
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void productionConstructorCanBeCreatedBySpring() {
|
||||||
|
contextRunner.run(context -> {
|
||||||
|
assertThat(context).hasNotFailed();
|
||||||
|
assertThat(context).hasSingleBean(UpdatePublishConfigClient.class);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
正在加载...
在新工单中引用
屏蔽一个用户