弹簧配置 [英] Spring Configuration

查看:81
本文介绍了弹簧配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I've been reading up on Spring and it keeps talking about the spring configuration data you need, but where do you put this xml file? and what do you save it as? I can't seem to find this information anywhere.

推荐答案

最重要的是,问题出在哪里:这个配置数据"到底是什么?

More importantly than where, the question should be for you: what exactly is this 'configuration data'?

来自

Spring IoC容器使用一种形式的配置元数据;此配置元数据表示您作为应用程序开发人员如何告诉Spring容器实例化,配置和组装应用程序中的对象.

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.

传统上,配置元数据以简单直观的XML格式提供,这是本章的大多数内容,用于传达Spring IoC容器的关键概念和功能.

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.

但是,您也可以使用注释

However, you can also use annotations or Java-based configuration to provide the configuration metadata for your POJOs.

在Spring中,构成应用程序主干并由Spring IoC容器管理的对象称为bean. Bean是由Spring IoC容器实例化,组装和以其他方式管理的对象.否则,bean仅仅是应用程序中许多对象之一. Bean及其之间的依赖关系反映在容器使用的配置元数据中.

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所述,此处,您可以找到如何在不同情况下实例化容器.

As Tnem already mentioned, here you can find how to instantiate a container in different scenarios.

这个IoC容器是什么?

And what is this IoC container?

IoC(控制反转)和DI(依赖项注入)是 Martin Fowler ,关于Spring,请参见

IoC (inversion of control) and DI (dependency injection) are terms coined by Martin Fowler, regarding Spring see the first section of the docs.

如果您想使用Spring进行开发,我建议您阅读整个参考资料.

I encourage you to read the whole reference if you want to get into development with Spring.

这篇关于弹簧配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆