package cclotus.cloud.gateway

import com.ruoyi.common.config.RuoYiConfig
import com.ruoyi.framework.config.DruidConfig
import com.ruoyi.framework.config.MyMetaObjectHandler
import com.ruoyi.framework.config.RedisConfig
import com.ruoyi.framework.config.properties.DruidProperties
import org.mybatis.spring.annotation.MapperScan
import org.mybatis.spring.annotation.MapperScans
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.*

@Configuration
@Import(
    DruidConfig::class,
    DruidProperties::class,
    RedisConfig::class
)
@EnableConfigurationProperties(RuoYiConfig::class)
@MapperScans(MapperScan("com.ruoyi.**.mapper"), MapperScan("com.cclotus.**.mapper"))
@ComponentScan(
    basePackages = ["com.ruoyi.system", "com.ruoyi.common", "com.cclotus.**"],
    excludeFilters = [ComponentScan.Filter(
        type = FilterType.REGEX,
        pattern = ["^com.cclotus.[\\w+.]+controller.admin.[\\w+.]*\\w+"]
    )]
)
class GatewayConfig {

    @Bean
    fun myMetaObjectHandler(): MyMetaObjectHandler {
        return MyMetaObjectHandler()
    }
}
