@Test public void testScan() { Map<String, VelocityTool> velocityToolsMap = scanner.scan(); Assert.assertFalse(velocityToolsMap.isEmpty()); }
@Override protected void scan(String[] sources, Map<String, VelocityTool> velocityToolsMap) { for (String basePackage : sources) { Set<BeanDefinition> candidates = provider.findCandidateComponents(basePackage); for (BeanDefinition beanDefinition : candidates) { Class<?> toolClass = resolveToolClass(beanDefinition); DefaultKey defaultKey = findAnnotation(toolClass, DefaultKey.class); String key = defaultKey.value(); String scope = getScope(toolClass); VelocityTool velocityTool = new VelocityTool(new ToolInfo(key, toolClass), scope); velocityToolsMap.put(key, velocityTool); } } }
AnnotatedVelocityToolsScanner extends AbstractVelocityToolsScanner implements ResourceLoaderAware { @Override protected void scan(String[] sources, Map<String, VelocityTool> velocityToolsMap) { for (String basePackage : sources) { Set<BeanDefinition> candidates = provider.findCandidateComponents(basePackage); for (BeanDefinition beanDefinition : candidates) { Class<?> toolClass = resolveToolClass(beanDefinition); DefaultKey defaultKey = findAnnotation(toolClass, DefaultKey.class); String key = defaultKey.value(); String scope = getScope(toolClass); VelocityTool velocityTool = new VelocityTool(new ToolInfo(key, toolClass), scope); velocityToolsMap.put(key, velocityTool); } } } }
AnnotatedVelocityToolsScanner extends AbstractVelocityToolsScanner implements ResourceLoaderAware { @Override protected void scan(String[] sources, Map<String, VelocityTool> velocityToolsMap) { for (String basePackage : sources) { Set<BeanDefinition> candidates = provider.findCandidateComponents(basePackage); for (BeanDefinition beanDefinition : candidates) { Class<?> toolClass = resolveToolClass(beanDefinition); DefaultKey defaultKey = findAnnotation(toolClass, DefaultKey.class); String key = defaultKey.value(); String scope = getScope(toolClass); VelocityTool velocityTool = new VelocityTool(new ToolInfo(key, toolClass), scope); velocityToolsMap.put(key, velocityTool); } } } AnnotatedVelocityToolsScanner(); }
AnnotatedVelocityToolsScanner extends AbstractVelocityToolsScanner implements ResourceLoaderAware { @Override protected void scan(String[] sources, Map<String, VelocityTool> velocityToolsMap) { for (String basePackage : sources) { Set<BeanDefinition> candidates = provider.findCandidateComponents(basePackage); for (BeanDefinition beanDefinition : candidates) { Class<?> toolClass = resolveToolClass(beanDefinition); DefaultKey defaultKey = findAnnotation(toolClass, DefaultKey.class); String key = defaultKey.value(); String scope = getScope(toolClass); VelocityTool velocityTool = new VelocityTool(new ToolInfo(key, toolClass), scope); velocityToolsMap.put(key, velocityTool); } } } AnnotatedVelocityToolsScanner(); @Override void setResourceLoader(ResourceLoader resourceLoader); @Override void setEnvironment(Environment environment); }
AnnotatedVelocityToolsScanner extends AbstractVelocityToolsScanner implements ResourceLoaderAware { @Override protected void scan(String[] sources, Map<String, VelocityTool> velocityToolsMap) { for (String basePackage : sources) { Set<BeanDefinition> candidates = provider.findCandidateComponents(basePackage); for (BeanDefinition beanDefinition : candidates) { Class<?> toolClass = resolveToolClass(beanDefinition); DefaultKey defaultKey = findAnnotation(toolClass, DefaultKey.class); String key = defaultKey.value(); String scope = getScope(toolClass); VelocityTool velocityTool = new VelocityTool(new ToolInfo(key, toolClass), scope); velocityToolsMap.put(key, velocityTool); } } } AnnotatedVelocityToolsScanner(); @Override void setResourceLoader(ResourceLoader resourceLoader); @Override void setEnvironment(Environment environment);  }