通过当前view content id拿到controller id,进而拿到controller实例。

Hybris team的同事张健在他写的公众号文章 从产品展示页面谈谈Hybris的特有概念和设计结构里介绍了product detail page的controller是如何被调用到的。

感谢Spring MVC的@RequestMapping, 让上图的url能够自动匹配到下图的ProductPageController。

具体这个controller的哪个方法会被调用来读取指定product的数据:
url里的product id会被这个pattern截获:

然后注入到变量productCode里,再call productFacade从DB取Product数据。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24475491/viewspace-2679093/ ,如需转载,请注明出处,否则将追究法律责任。