67,513
社区成员
发帖
与我相关
我的任务
分享
public class BeforeAdvice implements Ordered{
@Pointcut("execution(* com.*.*.ls.spxt.service.* .* (..))")
public void beforedd() {
//切换数据库
System.out.println("自动切换数据库");
//从数据库中得到该用户的数据
}
@Before(value = "beforedd()")
public void before(JoinPoint joinPoint){
System.out.println("sp");
DataSourceContextHolder.setDbType("ds_partner");
}
@After(value = "beforedd()")
public void After(JoinPoint joinPoint){
System.out.println("切回数据库");
}