MybatisPlusInterceptor implements Interceptor { @Override public void setProperties(Properties properties) { PropertyMapper pm = PropertyMapper.newInstance(properties); Map<String, Properties> group = pm.group("@"); group.forEach((k, v) -> { InnerInterceptor innerInterceptor = ClassUtils.newInstance(k); innerInterceptor.setProperties(v); addInnerInterceptor(innerInterceptor); }); }  @Override Object intercept(Invocation invocation); @Override Object plugin(Object target); void addInnerInterceptor(InnerInterceptor innerInterceptor); List<InnerInterceptor> getInterceptors(); @Override void setProperties(Properties properties);  }
@Test void setProperties() { Properties properties = new Properties(); properties.setProperty("@page", "com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor"); properties.setProperty("page:maxLimit", "10"); properties.setProperty("page:dbType", "h2"); MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); interceptor.setProperties(properties); List<InnerInterceptor> interceptors = interceptor.getInterceptors(); assertThat(interceptors).isNotEmpty(); assertThat(interceptors.size()).isEqualTo(1); InnerInterceptor page = interceptors.get(0); assertThat(page).isInstanceOf(PaginationInnerInterceptor.class); PaginationInnerInterceptor pii = (PaginationInnerInterceptor) page; assertThat(pii.getMaxLimit()).isEqualTo(10); assertThat(pii.getDbType()).isEqualTo(DbType.H2); }