struts2的静态注入(ObjectFactory)
来源:互联网 发布:盘古网络好进吗 编辑:程序博客网 时间:2024/05/29 05:08
ObjectFactory与静态注入
1、ObjectFactory:对象工厂
struts2的action是需要产生对象
struts2中拦截器是需要创建的
struts2的各种结果集也需要创建对象
2、ObjectFactory中的各种方法
buildAction是用来创建action的
buildInterceptor是用来创建interceptor
静态注入:
静态:凡是在struts的xml文件中配置的bean,例如:
<bean type="com.opensymphony.xwork2.ObjectFactory" name="struts" class="org.apache.struts2.impl.StrutsObjectFactory" />
在服务器启动的时候就会加载,而且只加载一次,所以为静态
注入:StrutsObjectFactory就给纳入到struts2容器中了,这样的现象为注入
应用:值栈的实现类也是通过静态注入改变的
1、ObjectFactory:对象工厂
struts2的action是需要产生对象
struts2中拦截器是需要创建的
struts2的各种结果集也需要创建对象
2、ObjectFactory中的各种方法
buildAction是用来创建action的
buildInterceptor是用来创建interceptor
buildResult是用来创建结果集
静态注入:
静态:凡是在struts的xml文件中配置的bean,例如:
<bean type="com.opensymphony.xwork2.ObjectFactory" name="struts" class="org.apache.struts2.impl.StrutsObjectFactory" />
在服务器启动的时候就会加载,而且只加载一次,所以为静态
注入:StrutsObjectFactory就给纳入到struts2容器中了,这样的现象为注入
应用:值栈的实现类也是通过静态注入改变的
<bean type="com.opensymphony.xwork2.util.ValueStackFactory" name="struts" class="com.opensymphony.xwork2.ognl.OgnlValueStackFactory" />
<bean type="com.opensymphony.xwork2.ObjectFactory" name="struts" class="org.apache.struts2.impl.StrutsObjectFactory" />
说明:struts2容器会去读该配置文件中的这个配置,然后决定action是由哪个类来创建的
总结:
1、在struts2中,拦截器,action等内容都是对象,都是通过ObjectFactory类中相应的方法完成的
2、ObjectFactory与静态注入相结合,可以改变struts2容器中的一些内容:
1、创建action的方式
2、生成拦截器的方式
3、结果集的生成
- struts2的静态注入(ObjectFactory)
- struts2的对象工厂(ObjectFactory)简介
- Struts2中的objectFactory
- 使用struts2的builder alias机制加载objectFactory
- struts.objectFactory 由spring管理struts2的Action实例
- struts2中的对象工厂和静态注入
- 关于cocos2dx的ObjectFactory
- NS3的ObjectFactory类
- spring-boot中可以注入 ObjectFactory<HttpMessageConverters>
- Spring的静态注入
- 静态redisTemplate的注入
- struts2中的constant介绍之struts.objectFactory与spring的整合
- struts2中的constant介绍之struts.objectFactory与spring的整合
- struts2中的constant介绍之struts.objectFactory与spring的整合
- 【引用】struts2中的constant介绍之struts.objectFactory与spring的整合
- struts2中的constant介绍之struts.objectFactory与spring的整合
- struts2中的constant介绍之struts.objectFactory与spring的整合
- struts2中的constant介绍之struts.objectFactory与spring的整合
- javascript解析xml文件。兼容IE、firefox、Chrome
- PHP的工作原理以及lamp四者之间的关系
- Java SE 学习笔记(七)
- 正则验证url和ip地址
- 把数据转换成XML格式的好处
- struts2的静态注入(ObjectFactory)
- IOS动画Core Animation详解
- 国外知名IT网站Stackoverflow评选的最有影响力IT图书
- java基础——多线程(线程的同步互斥与通信)
- 存储XML格式数据的原理
- sql where 1=1和 0=1 的作用
- 使用C语言编写PHP 5.5.4的扩展函数
- 安卓版微信内置浏览器,<a href="tel:电话号码"></a> 这个链接失效,跳到拨号界面
- ajax文件上传,采用ajaxfileupload插件