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 中添加依赖: * * com.ruoyi * dryad-payment * 1.0.0 * * * 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("================================="); } }