开发者

How to organize general purpose Spring controller functions?

I know that many people suggest grouping Spring controllers by page, i.e. "LoginPageController" and "LandingPageController," etc. So the GET handler and other request handlers for the login page are in LoginPageController.

I like this organization most of the time, but lately I'm adding more AJAX functionality, some of which can be reused across many pages and isn't necessarily tied to a si开发者_高级运维ngle page. I'm wondering what other people are doing in this situation. Maybe make a package for general purpose controllers and try to categorize them in there?

Any advice would be great!


I prefer to group by function. Given your example, I would have a ProjectController that handles both the pages related to Projects as well as the Ajax calls that get/update project data.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜