問題描述: 寫主庫開事務的狀況下會致使時不時的將更新/插入操做寫入到從庫上, 致使mysqlException update command deniedmysql
有時間再補一個Sequence圖sql
public class DataSourceAdvice implements MethodBeforeAdvice, AfterReturningAdvice, ThrowsAdvice { private static final Logger LOG = LoggerFactory.getLogger(DataSourceAdvice.class); @Override public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable { DataSourceSwitcher.clearDataSource(); } }