Code example for XmlBeanFactory

Methods: getBean

0
public class XmlProviderManagerFactory { 
 
	public static XmlProviderManager buildXmlProvider() { 
		 
		ClassPathResource res = new ClassPathResource("rayo-providers.xml");
		XmlBeanFactory factory = new XmlBeanFactory(res);
		XmlProviderManager manager = (XmlProviderManager)factory.getBean("xmlProviderManager");
		Validator validator = (Validator)factory.getBean("validator");
		 
		RayoClientProvider rayoClientProvider = new RayoClientProvider();
		rayoClientProvider.setNamespaces(new ArrayList<String>());
		rayoClientProvider.getNamespaces().add("urn:xmpp:rayo:1");
		rayoClientProvider.getNamespaces().add("jabber:client");
		rayoClientProvider.setValidator(validator);
		rayoClientProvider.setClasses(new ArrayList<Class<?>>());
		manager.register(rayoClientProvider);
		 
		return manager;
	} 
} 
Experience pair programming with AI  Get Codota for Java