
com.gitee.huanminabc.utils_tools.dynamic_datasource.aop.DBSwitch Maven / Gradle / Ivy
package com.gitee.huanminabc.utils_tools.dynamic_datasource.aop;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
//作用:方法和类
// 注意:
// 1.如果父类是抽象类,子类没有实现父类的方法,那么子类上的注解不会生效 ,实在没办法解决可以使用DBSwitch.switchDB进行行级切换
// 2.如果使用 @Transactional那么必须使用 @Transactional(propagation = Propagation.REQUIRES_NEW ,rollbackFor = Exception.class)否则数据源会一直使用默认的数据源,不会切换
@Target({ElementType.METHOD,ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface DBSwitch {
String value() default ""; //数据源的key
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy