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

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.

主站蜘蛛池模板: 衡南县| 堆龙德庆县| 板桥市| 溧阳市| 开原市| 奉化市| 广饶县| 泽普县| 建平县| 梁平县| 河津市| 舟山市| 华安县| 桃源县| 林口县| 海伦市| 庆阳市| 七台河市| 泰顺县| 周宁县| 古蔺县| 丰县| 逊克县| 桐庐县| 卓尼县| 锡林郭勒盟| 大城县| 乡宁县| 金湖县| 南通市| 普洱| 嘉峪关市| 蚌埠市| 南开区| 麟游县| 东阳市| 涞源县| 翁牛特旗| 田林县| 南开区| 牡丹江市|