2.3 Usage scenarios 使用场景
The building blocks described previously make Spring a logical choice in many scenarios, from embedded applications that run on resource-constrained devices to full-fledged enterprise applications that use Spring’s transaction management functionality and web framework integration.
之前描述的构建块使Spring
成为许多场景中的逻辑(也就是下意识合理的)选择,从资源受限的嵌入式程序到成熟的企业应用程序都可以使用 Spring
事务管理功能和 web
框架集成。
图2.2。 典型的完整Spring Web应用程序
Spring’s declarative transaction management features make the web application fully transactional, just as it would be if you used EJB container-managed transactions. All your custom business logic can be implemented with simple POJOs and managed by Spring’s IoC container. Additional services include support for sending email and validation that is independent of the web layer, which lets you choose where to execute validation rules. Spring’s ORM support is integrated with JPA and Hibernate; for example, when using Hibernate, you can continue to use your existing mapping files and standard Hibernate SessionFactory
configuration. Form controllers seamlessly integrate the web-layer with the domain model, removing the need for ActionForms
or other classes that transform HTTP parameters to values for your domain model.
Spring
的声明式事务管理特性使Web
应用程序具有完全事务性,就像使用EJB容器管理的事务一样。 所有的定制业务逻辑都可以通过简单的POJO
实现,并由Spring
的IoC容器
管理。 其他服务包括独立于Web
层的发送电子邮件和验证的支持,允许你选择执行验证规则的位置。 Spring
的ORM
支持集成了JPA
和Hibernate