为了实现动态控制mybatis拦截器,实现开关功能,特此记录
private static String enableFlag;
@Autowired
public EncryptInputParamInterceptor(@Value("${mybatis.interceptor.enable}") String enableFlag) {
this.enableFlag = enableFlag;
}
public EncryptInputParamInterceptor() {
// 无参构造函数,供 MyBatis 使用
}
@Override
public Object intercept(Invocation invocation) throws Throwable {
if ("false".equals(enableFlag)){
return invocation.proceed();
}
private static String enableFlag;
@Autowired
public EncryptInputParamInterceptor(@Value("${mybatis.interceptor.enable}") String enableFlag) {
this.enableFlag = enableFlag;
}
public EncryptInputParamInterceptor() {
// 无参构造函数,供 MyBatis 使用
}
@Override
public Object intercept(Invocation invocation) throws Throwable {
if ("false".equals(enableFlag)){
return invocation.proceed();
}