@WebService
public class DeviceService implements IDeviceService{
@Autowired
private IAccountManager accountManager;
private Account findUserByUsername(String username){
return accountManager.findAccountByUserName(username);
}
}
当调用private IAccountManager accountManager,如果没有正确配置,会报错,没有注入,造成抛空指针的错误。
解决了, sping集成cxf的时候注入sping管理的bean的时候比如说service层,用annotation标注了@Service
<bean id="dvrService" class="com.zhaohai.automation.device.webservice.DvrServiceImpl">
<property name="accountManager">
<ref bean="accountManagerImpl"/>
</property>
</bean>