【发布时间】:2012-06-13 09:29:18
【问题描述】:
我有一个用控制器实例化的特殊实体。在请求期间应该将它传递给处理程序的参数:
@Controller
@Scope("session")
public class HomeController {
@Autowired
Context context; // this thing should be passed into request.
//context field from controller should be passed into request parameter
//in order to set request attributes properly.
//The instance of CommonRequest class should have reference to the context during
//mapping HTTP request into CommonRequest object.
@RequestMapping(value = "/do_smth", method = RequestMethod.POST)
public void doSmth(CommonRequest request) {
}
}
有没有办法做到这一点?
【问题讨论】:
标签: spring controller code-injection