#230·zheng

BaseServiceImpl中的service为什么把抛出的异常都给吃了,而不给抛出来呢

Author: bighhhhCreated Dec 30, 2021Updated Dec 30, 2021

@Override public List selectByExample(Example example) { try { DynamicDataSource.setDataSource(DataSourceEnum.SLAVE.getName()); Method selectByExample = mapper.getClass().getDeclaredMethod("selectByExample", example.getClass()); Object result = selectByExample.invoke(mapper, example); return (List) result; } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } DynamicDataSource.clearDataSource(); return null; } 所有异常都给捕获了,并且也没打印日志,为啥不把异常抛给controller处理