publicclassAutoConfigNamespaceHandlerextendsNamespaceHandlerSupport{ @Override publicvoidinit(){ this.registerBeanDefinitionParser("enable-autoconfig", new SwitchParser()); this.registerBeanDefinitionParser("ucc-provider", new UccProviderParser()); }
staticclassSwitchParserimplementsBeanDefinitionParser{ @Override public BeanDefinition parse(Element element, ParserContext parserContext){ RootBeanDefinition beanDefinition = new RootBeanDefinition(); beanDefinition.setBeanClass(AutoConfigManager.class); return beanDefinition; } }
staticclassUccProviderParserimplementsBeanDefinitionParser{ @Override public BeanDefinition parse(Element element, ParserContext parserContext){ String id = element.getAttribute("id"); String path = element.getAttribute("path"); RootBeanDefinition beanDefinition = new RootBeanDefinition(); beanDefinition.setBeanClass(UCCProvider.class); beanDefinition.getPropertyValues().add("path",path); parserContext.getRegistry().registerBeanDefinition(id, beanDefinition); return beanDefinition; } }