请问通过@Service方式注入的类,怎么可以获取到?
eg.要获取名为companyCommand对象
在action中可以通过以下方式获取:
ServletContextservletContext = request.getSession().getServletContext();
ApplicationContext ctx = WebApplicationContextUtils
.getWebApplicationContext(servletContext);
CompanyCommandum = (CompanyCommand) ctx.getBean("companyCommand");
在
@Service("companyCommand")
public class CompanyCommand() {
@Resource
private WyBaseCommand baseCommand;
}
中怎么可以获取到注入的companyCommand对象?