Eclipse插件之Spring IDE
http://tech.ddvip.com 2006年11月20日 社区交流
本文详细介绍Eclipse插件之Spring IDE
public class HelloWorld1 implements IHelloWorld
{
public HelloWorld1()
{
super();
}
public String sayHelloWorld()
{
return "Hello World HelloWorld1";
}
}实现类二:HelloWorld2.java
public class HelloWorld2 implements IHelloWorld
{
public HelloWorld2()
{
super();
}
public String sayHelloWorld()
{
return "Hello World HelloWorld2";
}
}根据常用的三层与Spring的最佳实践,将配置文件分成了四个
beanRefFactory.xml负责总装,由SingletonBeanFactoryLocator来装入
通过ClassPathXmlApplicationContext来把其它三个模块的文件引入
beanRefDataAccess.xml负责DAO,与数据库相关的bean都定义在这里
beanRefService.xml负责Service层的bean定义
beanRefMVC.xml负责Spring MVC方面相关的bean定义等等
以下配置文件的bean定义为演示所用,各自的内容如下:
beanRefFactory.xml的内容如下:
<xml version="1.0" encoding="UTF-8">
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="beanFactory" class="org.springframework.context.support.ClassPathXmlApplicationContext">
<constructor-arg>
<list>
<value>beanRefDataAccess.xml</value>
<value>beanRefService.xml</value>
<value>beanRefMVC.xml</value>
</list>
</constructor-arg>
</bean>
</beans>beanRefDataAccess.xml的内容如下:
来源:BEA 作者:俞黎敏 责编:豆豆技术应用
正在加载评论...