new不能执行autowired_web启动@Autowired不能自动注入

package com.edar.web.platform;

import org.apache.struts2.convention.annotation.InterceptorRef;

import org.apache.struts2.convention.annotation.InterceptorRefs;

import org.apache.struts2.convention.annotation.Namespace;

import org.apache.struts2.convention.annotation.Result;

import org.apache.struts2.convention.annotation.Results;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.beans.factory.annotation.Qualifier;

import org.springframework.stereotype.Component;

import com.edar.components.AccountBean;

import com.edar.dao.util.Page;

import com.edar.model.Account;

import com.edar.service.platform.AccountService;

import com.edar.web.struts2.GenericAction;

@Component

@Namespace("/platform")

@InterceptorRefs( { @InterceptorRef("paramsPrepareParamsStack") })

@Results( { @Result(name = GenericAction.RELOAD, location = "account.action", type = "redirect") })

public class AccountAction extends GenericAction {

private static final long serialVersionUID = 1900042912756344244L;

@Autowired

@Qualifier("accountServiceImpl")

private AccountService accountService;

private AccountBean accountBean;

private Page page = new Page(16,true);

public AccountBean getAccountBean() {

return accountBean;

}

public void setAccountBean(final AccountBean accountBean) {

this.accountBean = accountBean;

}

public Page<AccountBean> getPage() {

return page;

}

public void setPage(final Page<AccountBean> page) {

this.page = page;

}

@Override

public String delete(){

accountService.delete((Account) dozer.map(accountBean, Account.class));

return SUCCESS;

}

@Override

public String list(){

page = accountService.getPage(accountBean);

return SUCCESS;

}

@Override

protected void prepareModel(){

if(accountBean==null){

accountBean = new AccountBean();

}else{

if(accountBean.getAccountId()!=null){

accountBean = (AccountBean)dozer.map(accountService.getAccount(accountBean.getAccountId()),

AccountBean.class);

}

}

}

@Override

public String save(){

Account account = (Account) dozer.map(accountBean, Account.class);

accountService.save(account);

accountBean.setAccountId(account.getAccountId());

return SUCCESS;

}

public AccountBean getModel() {

return accountBean;

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值