factor:租户信息服务类优化

This commit is contained in:
xiafang
2023-02-09 09:35:06 +08:00
parent 110b8b5cfc
commit bd782503ea
4 changed files with 12 additions and 7 deletions

View File

@@ -29,6 +29,8 @@ import java.util.Set;
import java.util.stream.Collectors;
/**
* 从配置文件中加载租户信息,默认实现,可被覆盖
*
* @author xiafang
* @since 2023/2/3 11:40
*/
@@ -37,7 +39,7 @@ public class InMemoryWechatTenantService implements WechatTenantService {
private final WechatPayProperties wechatPayProperties;
@Override
public Set<WechatMetaBean> getAllTenants() {
public Set<WechatMetaBean> loadTenants() {
Map<String, WechatPayProperties.V3> v3Map = wechatPayProperties.getV3();
KeyPairFactory keyPairFactory = new KeyPairFactory();
return v3Map.entrySet()

View File

@@ -44,7 +44,7 @@ public class WechatPayConfiguration {
@ConditionalOnMissingBean
WechatMetaContainer wechatMetaContainer(WechatTenantService wechatTenantService) {
WechatMetaContainer container = new WechatMetaContainer();
container.addWechatMetas(wechatTenantService.getAllTenants());
container.addWechatMetas(wechatTenantService.loadTenants());
return container;
}

View File

@@ -22,9 +22,12 @@ import cn.felord.payment.wechat.v3.WechatMetaBean;
import java.util.Set;
/**
* @author xiafang
* @since 2023/2/3 11:37
* 加载租户信息服务
*
* @author felord.cn
* @since 1.0.16.RELEASE
*/
@FunctionalInterface
public interface WechatTenantService {
Set<WechatMetaBean> getAllTenants();
Set<WechatMetaBean> loadTenants();
}

View File

@@ -26,8 +26,8 @@ import org.springframework.context.annotation.Configuration;
/**
* The type Wechat tenant service configuration.
*
* @author xiafang
* @since 2023 /2/3 12:32
* @author felord.cn
* @since 1.0.16.RELEASE
*/
@Configuration(proxyBeanMethods = false)
@Conditional(WechatPayConfiguredCondition.class)