package com.jiayue.ipfcst.client.aop; import com.jiayue.ipfcst.client.config.DynamicDataSource; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.springframework.stereotype.Component; @Component @Aspect public class DynamicDataSourceAspect { // 前置通知 @Before("within(com.jiayue.ipfcst.client.service..*) && @annotation(wr)") public void before(JoinPoint joinPoint, WR wr){ DynamicDataSource.setDataSource(wr.value()); } }