[英]Struts2 Spring autowire=“byType”
I am using struts2 with spring. 我在春天使用struts2。 In my struts.properties
file i have 在我的struts.properties
文件中
struts.objectFactory = spring
struts.objectFactory.spring.autoWire = type
I have a class like 我有一个像
public class JdbcDaoSupportMyDao extends JdbcDaoSupport implements myjdbcDao
{//......
//......
}
I have an entry in my applicationContext.xml like 我在applicationContext.xml中有一个条目,例如
<bean id = "jdbcdaobeanentry" class="Spring_Ingrtn.JdbcDaoSupportMyDao">
<property name="dataSource" ref="dataSource"></property>
</bean>
Now when i am having a setter/getter like 现在当我有一个二传手
private myjdbcDao jdbcsup;
public myjdbcDao getJdbcsup() {
return jdbcsup;
}
public void setJdbcsup(myjdbcDao jdbcsup) {
this.jdbcsup = jdbcsup;
}
It doesn't work ,it throws a NullPointerException
它不起作用,它抛出NullPointerException
Why is this so, when i have mapped struts.objectFactory.spring.autoWire = type
in my struts.properties
file. 为什么这样,当我映射了struts.objectFactory.spring.autoWire = type
在我的struts.properties
文件中struts.objectFactory.spring.autoWire = type
时。
Shouldn't it map to my Interface (ie ) ? 它不应该映射到我的界面(即)吗?
change 更改
struts.objectFactory.spring.autoWire = type
to 至
struts.objectFactory.spring.autoWire = auto
ie set the auto wire property to auto and let the container decide the best way to decide the wiring policy 即将自动连线属性设置为自动,并让容器决定最佳的连线策略决定方法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.