All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.mybatis.mp.routing.datasource.RoutingDataSourceAopAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 1.7.2
Show newest version
package cn.mybatis.mp.routing.datasource;


import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(prefix = Config.PREFIX + ".aop", name = "enabled", havingValue = "true", matchIfMissing = true)
@EnableConfigurationProperties(RoutingDataSourceAopProperties.class)
@AutoConfigureAfter(value = RoutingDataSourceAutoConfiguration.class)
public class RoutingDataSourceAopAutoConfiguration {

    @Bean
    RoutingDataSourceSpringInterceptor routingDataSourceSpringInterceptor() {
        return new RoutingDataSourceSpringInterceptor();
    }

    @Bean
    RoutingDataSourceAbstractPointcutAdvisor routingDataSourceAbstractPointcutAdvisor(RoutingDataSourceAopProperties routingDataSourceAopProperties, RoutingDataSourceSpringInterceptor routingDataSourceSpringInterceptor) {
        RoutingDataSourceAbstractPointcutAdvisor pointcutAdvisor = new RoutingDataSourceAbstractPointcutAdvisor(routingDataSourceSpringInterceptor);
        pointcutAdvisor.setOrder(routingDataSourceAopProperties.getOrder());
        return pointcutAdvisor;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy