fix(tenant): select update config client constructor

这个提交包含在:
XuqmGroup 2026-07-27 10:45:54 +08:00
父节点 d226936d78
当前提交 297a94a3e4
共有 2 个文件被更改,包括 26 次插入0 次删除

查看文件

@ -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);
});
}
}