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

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.

主站蜘蛛池模板: 襄垣县| 巴中市| 什邡市| 云浮市| 大石桥市| 汉阴县| 霍邱县| 宜君县| 通州市| 平昌县| 资中县| 昂仁县| 石景山区| 苍梧县| 富蕴县| 沁水县| 汕头市| 瑞金市| 锦屏县| 育儿| 赣榆县| 漳平市| 丰都县| 龙陵县| 府谷县| 白朗县| 晴隆县| 尤溪县| 大石桥市| 行唐县| 峨眉山市| 荔浦县| 开平市| 万安县| 石景山区| 松潘县| 调兵山市| 社会| 保山市| 虹口区| 武功县|