gpt4 book ai didi

xml - Spring 配置

转载 作者:IT老高 更新时间:2023-10-28 13:52:48 26 4
gpt4 key购买 nike

我一直在阅读 Spring,它一直在谈论您需要的 Spring 配置数据,但是您将这个 xml 文件放在哪里?你把它保存成什么?我似乎在任何地方都找不到此信息。

最佳答案

比在哪里更重要的是,问题应该是给你的:这个“配置数据”到底是什么?

来自 docs :

the Spring IoC container consumes a form of configuration metadata; this configuration metadata represents how you as an application developer tell the Spring container to instantiate, configure, and assemble the objects in your application.

Configuration metadata is traditionally supplied in a simple and intuitive XML format, which is what most of this chapter uses to convey key concepts and features of the Spring IoC container.

但是,您也可以使用 annotationsJava-based configuration为您的 POJO 提供配置元数据。

In Spring, the objects that form the backbone of your application and that are managed by the Spring IoC container are called beans. A bean is an object that is instantiated, assembled, and otherwise managed by a Spring IoC container. Otherwise, a bean is simply one of many objects in your application. Beans, and the dependencies among them, are reflected in the configuration metadata used by a container.

正如 Tnem 已经提到的,here您可以了解如何在不同的场景中实例化容器。

这个 IoC 容器是什么?

IoC(控制反转)和 DI(依赖注入(inject))是 Martin Fowler 创造的术语。 , 关于 Spring 见 first section of the docs .

如果您想使用 Spring 进行开发,我鼓励您阅读整个引用资料。

关于xml - Spring 配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6283653/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com