Spring Framework XmlBeanFactory - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework XmlBeanFactory class.

This code example shows how to use the following methods:getBean
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;
	} 
} 
6
CodeRank
This code example shows how to use the following methods:getBeanNamesForType, getBean
		if (beanFactory == null)
		{ 
			initSpring(); 
		} 
 
		String[] beanNamesForType = beanFactory.getBeanNamesForType(cl);
		if (beanNamesForType.length ==0) 
		{ 
			return null; 
		} 
		return beanFactory.getBean (beanNamesForType[0], cl);
	} 
	 
	public static Collection<AbstractStorageFacet> getStorageBeans()
	{ 
		if (beanFactory == null)
		{ 
			initSpring(); 
		} 
 
6
CodeRank
This code example shows how to use the following methods:getBean
{ 
	public static void main(String[] args)
		throws Exception	
	{		 
		Resource config=Resource.newResource(args.length==1?args[0]:"etc/jetty-spring.xml");
		XmlBeanFactory bf = new XmlBeanFactory(new UrlResource(config.getURL()));
		Server server = (Server) bf.getBean(args.length==2?args[1]:"Server");
		server.join();
	} 
} 
6
CodeRank
This code example shows how to use the following methods:getBean
			configPath) {
		if(factory != null) {
			return factory;
		} 
		Resource resource = new FileSystemResource(configPath);
		XmlBeanFactory xmlFactory = new XmlBeanFactory(resource);
		factory = (ExclusionFilterFactory) xmlFactory.getBean(CONFIG_ID);
		return factory;
	} 
	 
	/** 
	 * @param configPath String path to local Sprint XML configuration. This 
	 *        Spring config file must include a bean with id "excluder-factory" 
	 *        that implements  
	 *        org.archive.wayback.accesscontrol.ExclusionFilterFactory 
	 * @return an excluder fully configured via the XML Spring configuration  
	 * at configPath  
	 */ 
	public static ExternalExcluder getExcluder(String configPath) {
		return new ExternalExcluder(getFactory(configPath).get());
5
CodeRank
This code example shows how to use the following methods:getBean
    	throws Exception
    { 
		Realms realms;
         
        ClassPathResource config = new ClassPathResource( "SimpleSpringTest.xml" );
        XmlBeanFactory factory = new XmlBeanFactory( config );
 
        realms = (Realms) factory.getBean( "realms" );
		return realms;
    } 
     
 
	/** 
	 * Test remote access to token service.  In particular, authenticateUser() 
	 * and getTokenProperties().  
	 */ 
	public void testSimple() 
		throws Exception
	{ 
		Realms        realms;
5
CodeRank
This code example shows how to use the following methods:getBean
    } 
 
    @Test
    public void testGroupMapFromSpring() { 
        Map<String, GroupConfig> mossoGroupMap;
        mossoGroupMap = (Map<String, GroupConfig>) bf.getBean("mossoGroupMap");
        nop(); 
    } 
 
    private String encryptPasswd(String passwd) throws GeneralSecurityException {
        return Aes.b64encrypt(passwd.getBytes(), "mossoFailure");
    } 
 
    private String decryptPasswd(String base64str) throws GeneralSecurityException {
        byte[] ptext = Aes.b64decrypt(base64str, "mossoFailure");
        return Aes.bytes2str(ptext);
    } 
 
    private MossoAuth loadFromSpring() { 
        MossoAuth springMossoAuth;
3
CodeRank
This code example shows how to use the following methods:getBean
                "oracle.jms.AQjmsConnectionFactory", 
                bean.getClass().getName());
    } 
 
    public void testAqConnectionFactoryDefinitionWithQueueType() throws Exception {
        Object bean = this.beanFactory.getBean("aqQueueConnectionFactory");
        assertEquals("not the correct class",
                "oracle.jms.AQjmsQueueConnectionFactory", 
                bean.getClass().getName());
    } 
 
    public void testAqConnectionFactoryDefinitionWithTopicType() throws Exception {
        Object bean = this.beanFactory.getBean("aqTopicConnectionFactory");
        assertEquals("not the correct class",
                "oracle.jms.AQjmsTopicConnectionFactory", 
                bean.getClass().getName());
    } 
} 
3
CodeRank
This code example shows how to use the following methods:getBean
     */ 
    public TokenService getTokenService() throws Exception {
        TokenService service;
 
        ClassPathResource config = new ClassPathResource("TokenServiceTest.xml");
        XmlBeanFactory factory = new XmlBeanFactory(config);
 
        service = (TokenService) factory.getBean("tokenService");
        return service;
    } 
 
    @Specification 
    public void testCreateToken() throws Exception {
        assertUserPropertyIdentical("exolab\\castor"); 
        assertUserPropertyIdentical("tyredating\\pdv017@es.euromaster.com"); 
        assertUserPropertyIdentical("tyredating\\pdv017@es\\euromaster\\com"); 
 
    } 
 
    private void assertUserPropertyIdentical(String user) throws AuthenticationException, RemoteException {
5
CodeRank
This code example shows how to use the following methods:
		return sessionFactory;
	} 
 
	public static void readXml2() { 
		Resource cr = new ClassPathResource("applicationContext.xml");
		BeanFactory bf = new XmlBeanFactory(cr);
 
	} 
 
	public static SessionFactory GetSessionFactoryForWeb() {
		// ClassPathXmlApplicationContext[只能读放在web-info/classes目录下的配置文件] 
		ApplicationContext context = new ClassPathXmlApplicationContext(
				new String[] { " /applicationContext.xml" });
		BeanFactory factory = new XmlBeanFactory((Resource) context);
		SessionFactory sessionFactory = (SessionFactory) factory
				.getBean("sessionFactory");
		return sessionFactory;
	} 
 
	public static SessionFactory GetSessionFactory() {
4
CodeRank
This code example shows how to use the following methods:
		readXmlWebRootForContext(); // 初始华spring 
	} 
 
	public static void readXml2() { 
		Resource cr = new ClassPathResource("applicationContext.xml");
		BeanFactory bf = new XmlBeanFactory(cr);
 
	} 
 
	// 读class目录下面的配置文件 
	public static BeanFactory readXMlClassPathToBeanFactory() {
		// ApplicationContext 
		ClassPathXmlApplicationContext resource = new ClassPathXmlApplicationContext(
				new String[] { "/applicationContext.xml" });
		BeanFactory factory = resource;
 
		return factory;
 
	} 
 
5
CodeRank
See Code Examples for Spring Framework XmlBeanFactory Methods: