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

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.

主站蜘蛛池模板: 宁武县| 麻江县| 乐业县| 周至县| 葫芦岛市| 科尔| 平山县| 章丘市| 镇坪县| 德兴市| 四子王旗| 法库县| 西峡县| 泸西县| 新建县| 金门县| 乌拉特后旗| 莱州市| 出国| 榆社县| 内江市| 望城县| 江城| 岐山县| 苏尼特左旗| 高要市| 修水县| 吴忠市| 宁国市| 青阳县| 冷水江市| 武定县| 延安市| 临潭县| 商洛市| 南通市| 邹城市| 玛沁县| 葵青区| 湄潭县| 娄烦县|