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

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.

主站蜘蛛池模板: 镇平县| 张家川| 施甸县| 云安县| 彭阳县| 义乌市| 商城县| 年辖:市辖区| 丰原市| 博乐市| 巴楚县| 昌邑市| 那坡县| 深州市| 甘德县| 阿图什市| 西贡区| 华容县| 政和县| 安阳市| 神木县| 阿合奇县| 伊金霍洛旗| 建宁县| 琼海市| 咸宁市| 合江县| 灵台县| 阜阳市| 高要市| 阳朔县| 平阴县| 漾濞| 通河县| 中山市| 汉源县| 柏乡县| 神池县| 南皮县| 西和县| 西昌市|