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
|
* @author felord.cn
|
||||||
* @since 1.0.0.RELEASE
|
* @since 1.0.0.RELEASE
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration(proxyBeanMethods = false)
|
||||||
@Conditional(WechatPayConfiguredCondition.class)
|
@Conditional(WechatPayConfiguredCondition.class)
|
||||||
@EnableConfigurationProperties(WechatPayProperties.class)
|
@EnableConfigurationProperties(WechatPayProperties.class)
|
||||||
public class WechatPayConfiguration {
|
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.Bindable;
|
||||||
import org.springframework.boot.context.properties.bind.Binder;
|
import org.springframework.boot.context.properties.bind.Binder;
|
||||||
import org.springframework.context.annotation.ConditionContext;
|
import org.springframework.context.annotation.ConditionContext;
|
||||||
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
import org.springframework.core.type.AnnotatedTypeMetadata;
|
import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||||
|
|
||||||
@@ -37,6 +38,7 @@ import java.util.stream.Collectors;
|
|||||||
* @author felord.cn
|
* @author felord.cn
|
||||||
* @since 1.0.3.RELEASE
|
* @since 1.0.3.RELEASE
|
||||||
*/
|
*/
|
||||||
|
@Order
|
||||||
public class WechatPayConfiguredCondition extends SpringBootCondition {
|
public class WechatPayConfiguredCondition extends SpringBootCondition {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,7 +59,8 @@ public class WechatPayConfiguredCondition extends SpringBootCondition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, WechatPayProperties.V3> getV3(Environment environment) {
|
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());
|
.orElse(Collections.emptyMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
20
pom.xml
20
pom.xml
@@ -132,6 +132,7 @@
|
|||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<pluginManagement>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
@@ -190,5 +191,24 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
</pluginManagement>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-gpg-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.sonatype.plugins</groupId>
|
||||||
|
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
||||||
Reference in New Issue
Block a user