DynamicDataSourceAspect.java 540 B

1234567891011121314151617181920
  1. package com.jiayue.ipfcst.client.aop;
  2. import com.jiayue.ipfcst.client.config.DynamicDataSource;
  3. import org.aspectj.lang.JoinPoint;
  4. import org.aspectj.lang.annotation.Aspect;
  5. import org.aspectj.lang.annotation.Before;
  6. import org.springframework.stereotype.Component;
  7. @Component
  8. @Aspect
  9. public class DynamicDataSourceAspect {
  10. // 前置通知
  11. @Before("within(com.jiayue.ipfcst.client.service..*) && @annotation(wr)")
  12. public void before(JoinPoint joinPoint, WR wr){
  13. DynamicDataSource.setDataSource(wr.value());
  14. }
  15. }