首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Strust2 框架中的有关问题备忘录

2012-09-21 
Strust2 框架中的问题备忘录Strust2 internal? Container 如何将spring容器中的bean注入到静态类中的??在s

Strust2 框架中的问题备忘录

Strust2 internal? Container 如何将spring容器中的bean注入到静态类中的?

?

在struts-plugin.xml这个文件中的配置信息,如下:

?

?

?

type一般是一组bean的接口,而class 是每个bean的实现类,而name则是这些bean的具体名字,这个名字起到了这个配置项目的identity作用。

?

在java代码中当在上下文中拿到container对象之后,可以通过如下方式来操作配置在struts2配置文件中的bean:

?

?

?同样是org.apache.struts2.dispatcher.mapper.ActionMapper 这个接口,但是有四种不同的实现,但是在org.apache.struts2.dispatcher.FilterDispatcher

@Injectpublic void setTestInterface(ITestInterface testInterface) {this.testInterface = testInterface;}

?会把名字为name为default的实现版本注入到action中,这样问题又来了,在默认的struts-default.xml文件中有配置的bean的name并不是以default开头的,那他们是按照怎么一个规则被注入到别的bean中的呢?

这个可以查看一下 struts.properties 配置文件 http://struts.apache.org/2.0.11/docs/strutsproperties.html

?

?

热点排行