在EasyJWeb使用spring容器
2007-12-17 10:28
218 查看
在EasyJWeb里面可以使用spring容器来帮助管理bean: 在JWeb的配置文件中加入:<bean name="springContainer"
class="org.springframework.context.support.ClassPathXmlApplicationContext">
<constructor-arg type="java.lang.String[]">
<list>
<value>classpath:applicationContext.xml</value>
</list>
</constructor-arg>
</bean> <bean name="innerSpringContainer"
class="com.easyjf.container.impl.SpringContainer">
<property name="factory" ref="springContainer" />
</bean>其中的<list><value>classpath:dao.xml</value></list>为spring配置文件的路径,现在暂时使用的是ClassPathXmlApplicationContext。 现在在applicationContext.xml中配置一个bean(片断): <bean id="queryService"
class="com.easyjf.core.service.impl.QueryServiceImpl">
<property name="dao">
<bean parent="baseDAO">
<constructor-arg>
<value>java.lang.Object</value>
</constructor-arg>
</bean>
</property>
</bean> 然后在Action中:private IQueryService service; public void setService(IQueryService service) {
this.service = service;
} 在Action的配置中:<module name="nesource" path="/nesource" form="" scope="request"
...
<page name="edit" url="/cms/newsSourceEdit.html" type="template" />
<property name="service" ref="cmsManageService" /> ...
</module>在配置中用ref指定spring中的bean。好,到这里就OK了。easyJWeb会在框架初始化的时候发现spring容器并初始化,并从其中加载需要的bean 。 该功能暂定如此,还会有更多细节的改进。请继续关注。谢谢!
(注:本文作者,EasyJF开源团队 stef_wu,转载请保留作者声明!)
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1535034
class="org.springframework.context.support.ClassPathXmlApplicationContext">
<constructor-arg type="java.lang.String[]">
<list>
<value>classpath:applicationContext.xml</value>
</list>
</constructor-arg>
</bean> <bean name="innerSpringContainer"
class="com.easyjf.container.impl.SpringContainer">
<property name="factory" ref="springContainer" />
</bean>其中的<list><value>classpath:dao.xml</value></list>为spring配置文件的路径,现在暂时使用的是ClassPathXmlApplicationContext。 现在在applicationContext.xml中配置一个bean(片断): <bean id="queryService"
class="com.easyjf.core.service.impl.QueryServiceImpl">
<property name="dao">
<bean parent="baseDAO">
<constructor-arg>
<value>java.lang.Object</value>
</constructor-arg>
</bean>
</property>
</bean> 然后在Action中:private IQueryService service; public void setService(IQueryService service) {
this.service = service;
} 在Action的配置中:<module name="nesource" path="/nesource" form="" scope="request"
...
<page name="edit" url="/cms/newsSourceEdit.html" type="template" />
<property name="service" ref="cmsManageService" /> ...
</module>在配置中用ref指定spring中的bean。好,到这里就OK了。easyJWeb会在框架初始化的时候发现spring容器并初始化,并从其中加载需要的bean 。 该功能暂定如此,还会有更多细节的改进。请继续关注。谢谢!
(注:本文作者,EasyJF开源团队 stef_wu,转载请保留作者声明!)
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1535034
相关文章推荐
- 在EasyJWeb使用spring容器
- 在EasyJWeb使用spring容器
- 在EasyJWeb使用spring容器
- 在EasyJWeb使用spring容器
- 在EasyJWeb使用spring容器
- 在EasyJWeb使用spring容器
- 在EasyJWeb使用spring容器
- 在EasyJWeb使用spring容器
- 在EasyJWeb使用spring容器
- 在EasyJWeb使用spring容器
- 在EasyJWeb使用spring容器
- 在EasyJWeb使用spring容器
- 在EasyJWeb使用spring容器
- 在EasyJWeb使用spring容器
- 在EasyJWeb使用spring容器
- Spring读书笔记-----使用Spring容器(二)
- springMVC子容器使用spring父容器配置文件资源
- 1.使用ApplicationContext的方式实例化Spring容器。
- Spring使用教程2--启动Spring容器
- Spring常用注解 使用注解来构造IoC容器