mirror of
https://github.com/dromara/payment-spring-boot.git
synced 2026-03-14 05:43:46 +08:00
refactor: 降低支付相关的Spring Bean初始化优先级
- 降低配置初始化的优先级,以适应Apollo等配置中心
This commit is contained in:
@@ -34,7 +34,7 @@ import java.util.Map;
|
||||
* @author felord.cn
|
||||
* @since 1.0.0.RELEASE
|
||||
*/
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@Conditional(WechatPayConfiguredCondition.class)
|
||||
@EnableConfigurationProperties(WechatPayProperties.class)
|
||||
public class WechatPayConfiguration {
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
|
||||
import org.springframework.boot.context.properties.bind.Bindable;
|
||||
import org.springframework.boot.context.properties.bind.Binder;
|
||||
import org.springframework.context.annotation.ConditionContext;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||
|
||||
@@ -37,6 +38,7 @@ import java.util.stream.Collectors;
|
||||
* @author felord.cn
|
||||
* @since 1.0.3.RELEASE
|
||||
*/
|
||||
@Order
|
||||
public class WechatPayConfiguredCondition extends SpringBootCondition {
|
||||
|
||||
/**
|
||||
@@ -57,7 +59,8 @@ public class WechatPayConfiguredCondition extends SpringBootCondition {
|
||||
}
|
||||
|
||||
private Map<String, WechatPayProperties.V3> getV3(Environment environment) {
|
||||
return Binder.get(environment).bind("wechat.pay.v3", STRING_WECHAT_V3_MAP)
|
||||
return Binder.get(environment)
|
||||
.bind("wechat.pay.v3", STRING_WECHAT_V3_MAP)
|
||||
.orElse(Collections.emptyMap());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user