struts-default.xml配置文件中的bean配置
<bean class="com.opensymphony.xwork2.ObjectFactory" name="xwork" />
<bean type ="com.opensymphony.xwork2.ObjectFactory" name ="struts" class ="org.apache.struts2.impl.StrutsObjectFactory" />
bean通常有两个作用
- 创建bean实例,将该实例作为struts2框架的核心组件使用(该实例实现接口,接口是组件遵循的规范)
- bean包含的静态方法需要一个值注入
type : bean实现的接口
class : bean的实现类