mirror of
https://github.com/dromara/payment-spring-boot.git
synced 2026-03-13 21:33:41 +08:00
factor:租户信息服务类优化
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user