| |
加载XML文件组件定义 |
|
/*
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"));
}
}
|
|
LoadBeanDefinitionFromXMLFile.zip( 1,197 k) |
Related examples in the same category |
|