Can anyone recommend a Java web framework that is based on MVC and supports REST?

后端 未结 5 1104
深忆病人
深忆病人 2020-12-18 09:23

We are looking to host a Java Domain Model (written using DDD) inside a web application. Ideally I would like to support RESTful resources and requests, having a single site

5条回答
  •  甜味超标
    2020-12-18 10:22

    Spring is great. I've used it for some projects and recently also together with Liferay portal server for developing a portlet.

    Why is Spring good?

    • It is a non-invasive framework: This means your application code doesn't depend on the framework (uses the IoC - Inversion of Control - concept). Spring does just what a good framework should do: support the development and not create further dependencies.
    • Dependency Injection: Spring uses the dependency injection concept which is great for avoiding dependencies on your code. You will define the dependencies in a spring xml configuration file where you define your beans and connections/relations among beans. This greatly facilitates reuse, lowers strong coupling among your objects which leads to better maintainability of your code.
    • It's not just a web framework: Spring MVC provides a lot of different controllers which are suitable in different contexts. But it isn't just a web framework but it supports the development on all the different layers (presentation, service and data access layers). For instance on the data access layers it nicely integrates with ORM mappers like Hibernate and it uses Aspect-oriented approaches for providing transaction management.
    • Lower-coupling -> increases testability: By avoiding strong coupling, the testability of your code will be increased. You can nicely inject mock objects for testing the different layers.

    All in all, I just had positive experiences, because Spring really promotes best practices.

提交回复
热议问题