108

编写 Spring 配置文件的13个最佳实践 | 开发者秘籍_开发者提升

 6 years ago
source link: https://dev-cheats.com/java/best-practices-for-writing-spring-configuration-files.html?
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Spring 是一个功能强大的Java应用框架,提供各种配置选项。它的核心特性是为简单的Java对象(PO​​JO)提供服务,称为 Bean。 Spring使用依赖注入(DI)来实现简化和增加可测试性。Spring beans及依赖,以及beans类所需的服务都在配置文件中进行了详细的说明,这个配置文件是典型的XML格式。但是它既冗长又不实用。对于需要定义大量Spring beans的大工程来说,我们难以阅读和管理它。 在这篇文章里,对于Spring XML的配置,我将向你展示13种比较好的实践。其中的一些实践不仅是好的实践,更是必要的实践。除此以外,还有其他因素,例如领域模型的设计,都能影响XML的配置,但是这篇文章重点研究XML配置的易读性和易管理性。

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK