Load Bean Definition From XML File : IoC Config : Spring : Java examples (example source code) Organized by topic

Java
C++
Java Home »  Spring   » [  IoC Config  ]  Screenshots 
 



Load Bean Definition From XML File

/*
Pro Spring
By Rob Harrop
Jan Machacek
ISBN: 1-59059-461-4
Publisher: Apress
*/



///////////////////////////////////////////////////////////////////////////////////////
//File: beans.xml
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
    
    <!-- oracle bean used for a few examples -->
    <bean id="beanId" name="beanName" class="Bean"/>
    
</beans>




///////////////////////////////////////////////////////////////////////////////////////
public class Bean{

}


///////////////////////////////////////////////////////////////////////////////////////

import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.FileSystemResource;

public class XmlConfigWithBeanFactory {

    public static void main(String[] args) {
        XmlBeanFactory factory = new XmlBeanFactory(new FileSystemResource(
                "build/beans.xml"));

    }
}


           
       
Download: LoadBeanDefinitionFromXMLFile.zip   ( 1,197  K )  
Related examples in the same category
1.  Simplest Usage of property config file In SpringHas Download File
2.  IoC XML ConfigHas Download File
3.  Lookup DemoHas Download File
4.  IoC in properties fileHas Download File








Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.