开发者

Get hold of Spring model from everywhere

In a controller I can get model by declaring Model/ModelMap typed parameter. In handler interceptors and in view rendering I get the same. But how do I get the model from the arbitrary class, which can get hold of Application开发者_如何学运维Context or web request? I just don't want to use model.addAttribute() all the time and would like my service automatically put objects into model.


The idea is that you shouldn't. Your controllers are the entry point of your application, so you get them there, and pass them as arguments to the layers below.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜