尝试注入对象时出现空指针异常。这是我的代码:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext.xml
</param-value>
</context-param>'
应用程序上下文.XML
<bean id="accessDao"
Class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
autowire-candidate="true">
<property name="transactionManager" ref="txManager" />
<property name="target" ref="accessDaoTarget" />
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean> '
普通豆
import com.domain.dao.IDao;
@Named
public class CommonBean implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
@Inject
private IDao accessDao;
public IDao getAccessDao()
{
return accessDao;
}
public void setAccessDao(IDao accessDao)
{
this.accessDao = accessDao;
}
}