简体   繁体   中英

Best Practice Spring 4 Controller MVC - Service releation

I have a question which i couldn't find on the net. So what is actually the best practice to use Controllers in SPRING 4 MVC? Is it better to use for each service one controller, which produce a lot of controllers if you have a lot of services. In my case i would need about 12 controllers?

I have also only some services which only call simple dao methods like create/getAll and so on. And other services that generate specific data out of there input.

So what would you recommend to handle a best practice?

best regards patrick

Use a controller per functionnality (ie: customer management, auth, registration, ...).

In your controller, process only the HTTP request and then call your services or directly your dao (if it is a basic processing like CRUD operations)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM