官术网_书友最值得收藏!

Defining Spring application context

Every Spring application requires a context, a place where every component is registered. We could think about it like a central directory of object instances created by our application. When we use the Spring Framework and create something, for example, a connection pool, it gets registered in our context or when we create our own components they will be registered as well. So, if in another part of the application we require that component, instead of creating it again we can just access it. However, this provides more advanced features. If we want, for example, to register a controller that handles HTTP requests, as we do in our example, we could just do it anywhere in our classes. Later, the application could use the component scan to find what controllers we have and wire them to web interfaces, without requiring any configuration. Let's understand the component scan better in the following section.

主站蜘蛛池模板: 凤城市| 昭觉县| 泽州县| 宁陕县| 巴林左旗| 阳信县| 会宁县| 广元市| 兴仁县| 林芝县| 三原县| 崇文区| 泰来县| 大余县| 盘山县| 盘山县| 西乌珠穆沁旗| 丹寨县| 桃江县| 青神县| 定南县| 抚顺县| 北安市| 正宁县| 通山县| 昌黎县| 黑水县| 平陆县| 孝昌县| 时尚| 丹棱县| 泰来县| 栖霞市| 哈密市| 温州市| 江津市| 鸡泽县| 沈丘县| 榆林市| 安塞县| 定兴县|