DefaultModuleScanStrategy implements IModuleScanStrategy { @Override public com.carl.wolf.core.bean.Module process(Object bean) throws ModuleScanException { logger.debug("扫描对象 " + bean.getClass().getName()); Module module = bean.getClass().getAnnotation(Module.class); if (module == null) { throw new ModuleScanException(bean.getClass().getName() + "需要com.carl.wolf.core.annotation.Module注解"); } com.carl.wolf.core.bean.Module moduleVo = new com.carl.wolf.core.bean.Module(); Method[] methods = bean.getClass().getMethods(); List<com.carl.wolf.core.bean.Menu> menus = new ArrayList<>(); for (Method method : methods) { Menu menu = method.getDeclaredAnnotation(Menu.class); if (menu != null) { if (getMenuScanStrategy().support(method)) { menus.add(getMenuScanStrategy().process(method)); } } } moduleVo.setDescription(module.description()) .setName(module.name()) .setOrder(module.order()) .setOpen(module.open()) .setTarget(bean) .setMenus(menus) .setIcon(module.icon()) .setPros(propertiesResolve(module.pros())); logger.debug(JSONUtil.toJSONStr(moduleVo)); return moduleVo; }  @Override com.carl.wolf.core.bean.Module process(Object bean); @Override IMenuScanStrategy getMenuScanStrategy(); @Override boolean support(Object target);  }
@Test public void process() throws Exception { DefaultModuleScanStrategy scanStrategy = new DefaultModuleScanStrategy(); Module module = scanStrategy.process(controller); Assert.assertEquals(2, module.getMenus().size()); Assert.assertEquals(1, module.getPros().get("age")); Assert.assertEquals("系统管理", module.getName()); }