SSH, DWR, 暴露类中采用注入的方式注入service。如何配置?

DWR类

public class BookDWR extends ActionSupport{
@Resource
BookService bookService = null;

private List bookList = new ArrayList();
public List getBookList() {
return bookList;
}
public void setBookList(List bookList) {
this.bookList = bookList;
}

public List testGetBook() throws Exception{
return bookService.getAllBookList();
}
}

dwr.xml
图片说明
dwr类相当于action类,里面注入service, service中注入dao, 请问如何配置才能让spring注入service。

creator=“new” 上图中的spring是我尝试的时候用的,忘记改了。

@Resource(name="testService")------resource是按name的方式注入的,所有最好你要写上name
如果想按类型自动注入,则应该用@Autowired
还有你BookService bookService = null;不要让这个=null,
@Resource(name="testService")//或@Autowired
BookService bookService;

然后配置文件中开启注解扫描