wlzboy
16 小时以前 5f2ee03958a1a16dc27195c76ea7cffb422c95d1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.ruoyi.payment.config;
 
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
 
/**
 * 支付模块自动配置类
 * 
 * 使用方式:
 * 1. 作为组件集成到其他项目时,在主项目的 pom.xml 中添加依赖:
 *    <dependency>
 *        <groupId>com.ruoyi</groupId>
 *        <artifactId>dryad-payment</artifactId>
 *        <version>1.0.0</version>
 *    </dependency>
 * 
 * 2. 在主项目的 application.yml 中配置:
 *    payment:
 *      enabled: true  # 启用支付模块
 *      wechat: ...    # 微信配置
 *      alipay: ...    # 支付宝配置
 * 
 * @author ruoyi
 */
@Configuration
@ConditionalOnProperty(prefix = "payment", name = "enabled", havingValue = "true", matchIfMissing = true)
@ComponentScan(
    basePackages = {
        "com.ruoyi.payment.interfaces.controller",
        "com.ruoyi.payment.application.service",
        "com.ruoyi.payment.domain.service",
        "com.ruoyi.payment.infrastructure"
    },
    excludeFilters = @ComponentScan.Filter(
        type = FilterType.REGEX,
        pattern = "com\\.ruoyi\\.payment\\.example\\..*"
    )
)
public class PaymentAutoConfiguration {
    
    public PaymentAutoConfiguration() {
        System.out.println("=================================");
        System.out.println("支付模块已启用");
        System.out.println("=================================");
    }
}