openlayers研究(一) 初始化流程

下载2.13.1。解压缩。根据readme解释,openlayers.js是一个压缩库,.light是一个图像显示的简化库,mobile顾名思义应该是应对移动设备的库。build里面有py写的打包工具,可以配置生成openlayers.js。

我最开始从lib里面的openlayers.js看,对ol的初始化顺序很困惑,因为最开始就判断OpenLayers这个对象,明明没有地方创建

lib下面的openlayers.js

后来查看根目录下面的OpenLayers.js时候发现原来是先加载的singlefile.js这个文件

于是查看lib\openlayers\下面的singlefile.js文件,原来这里就是真正创建OpenLayers的地方。

OK,回到lib下面的openlayers.js,看看openLayers是如何初始化的

(function() {
    /**
     * Before creating the OpenLayers namespace, check to see if
     * OpenLayers.singleFile is true.  This occurs if the
     * OpenLayers/SingleFile.js script is included before this one - as is the
     * case with old single file build profiles that included both
     * OpenLayers.js and OpenLayers/SingleFile.js.
     */
    var singleFile = (typeof OpenLayers == "object" && OpenLayers.singleFile);

//----------------这里首先判断是否singlefile.js已经执行过了,并且通过Openlayers.singlefile来判断加载的那个openlyers.js文件(压缩和非压缩),

其实singlefile.js的逻辑已经被弃用了,因为在openlayers.js下面又创建了一遍openlayers,这段代码其实没什么实际感觉。

/**
     * Relative path of this script.
     */
    var scriptName = (!singleFile) ? "lib/OpenLayers.js" : "OpenLayers.js";  //--------------------------指定当前加载的js的相对路径

/*
     * If window.OpenLayers isn‘t set when this script (OpenLayers.js) is
     * evaluated (and if singleFile is false) then this script will load
     * *all* OpenLayers scripts. If window.OpenLayers is set to an array
     * then this script will attempt to load scripts for each string of
     * the array, using the string as the src of the script.
     *
     * Example:
     * (code)
     *     <script type="text/javascript">
     *         window.OpenLayers = [
     *             "OpenLayers/Util.js",
     *             "OpenLayers/BaseTypes.js"
     *         ];
     *     </script>
     *     <script type="text/javascript" src="../lib/OpenLayers.js"></script>
     * (end)
     * In this example OpenLayers.js will load Util.js and BaseTypes.js only.
     */
    var jsFiles = window.OpenLayers;

//----------------------------------------------------根据上面解释,ol可以通过在引入openlayers.js之前,设置window.OpenLayers这个属性[],在这个属性中来使用相对路径来显示的声明要加载那些模块。下面加载时使用。

//新初始化OpenLayers所以,先把值记录下来。

/**
     * Namespace: OpenLayers
     * The OpenLayers object provides a namespace for all things OpenLayers                       
     */

//--------------------------------------------------------下面创建一个OpenLayers对象,全局命名空间,闭包外、方法外的var变量是一个全景变量,在方法或闭包内用windows.xxx也可以声明一个全局变量,其实通过这里就可以看出来,在singlefile中创建的openlayers其实没用,在判断完加载的版本和需要加载的插件js后,在下面会重新创建一个全局域的OpenLayers,这个全局域的OpenLayers和singlefile中定义的代码是一样的。---------------

window.OpenLayers = {                                                           
        /**
         * Method: _getScriptLocation
         * Return the path to this script. This is also implemented in
         * OpenLayers/SingleFile.js
         *
         * Returns:
         * {String} Path to this script
         */
        _getScriptLocation: (function() {
            var r = new RegExp("(^|(.*?\\/))(" + scriptName + ")(\\?|$)"),
                s = document.getElementsByTagName(‘script‘),
                src, m, l = "";
            for(var i=0, len=s.length; i<len; i++) {
                src = s[i].getAttribute(‘src‘);
                if(src) {
                    m = src.match(r);
                    if(m) {
                        l = m[1];
                        break;
                    }
                }
            }
            return (function() { return l; });
        })(),
        /**
         * APIProperty: ImgPath
         * {String} Set this to the path where control images are stored, a path 
         * given here must end with a slash. If set to ‘‘ (which is the default)
         * OpenLayers will use its script location + "img/".
         *
         * You will need to set this property when you have a singlefile build of
         * OpenLayers that either is not named "OpenLayers.js" or if you move
         * the file in a way such that the image directory cannot be derived from
         * the script location.
         *
         * If your custom OpenLayers build is named "my-custom-ol.js" and the images
         * of OpenLayers are in a folder "/resources/external/images/ol" a correct
         * way of including OpenLayers in your HTML would be:
         *
         * (code)
         *   <script src="/path/to/my-custom-ol.js" type="text/javascript"></script>
         *   <script type="text/javascript">
         *      // tell OpenLayers where the control images are
         *      // remember the trailing slash
         *      OpenLayers.ImgPath = "/resources/external/images/ol/";
         *   </script>
         * (end code)
         *
         * Please remember that when your OpenLayers script is not named
         * "OpenLayers.js" you will have to make sure that the default theme is
         * loaded into the page by including an appropriate <link>-tag,
         * e.g.:
         *
         * (code)
         *   <link rel="stylesheet" href="/path/to/default/style.css"  type="text/css">
         * (end code)
         */
        ImgPath : ‘‘
    };

/**
     * OpenLayers.singleFile is a flag indicating this file is being included
     * in a Single File Library build of the OpenLayers Library.
     *
     * When we are *not* part of a SFL build we dynamically include the
     * OpenLayers library code.
     *
     * When we *are* part of a SFL build we do not dynamically include the
     * OpenLayers library code as it will be appended at the end of this file.

//--------------------------------------------------------如果不是压缩模式,并且没有指定加载的js文件,则默认加载如下js通过document.write

*/
    if(!singleFile) {
        if (!jsFiles) {
            jsFiles = [
                "OpenLayers/BaseTypes/Class.js",
                "OpenLayers/Util.js",
                "OpenLayers/Util/vendorPrefix.js",
                "OpenLayers/Animation.js",
                "OpenLayers/BaseTypes.js",
                "OpenLayers/BaseTypes/Bounds.js",
                "OpenLayers/BaseTypes/Date.js",
                "OpenLayers/BaseTypes/Element.js",
                "OpenLayers/BaseTypes/LonLat.js",
                "OpenLayers/BaseTypes/Pixel.js",
                "OpenLayers/BaseTypes/Size.js",
                "OpenLayers/Console.js",
                "OpenLayers/Tween.js",
                "OpenLayers/Kinetic.js",
                "OpenLayers/Events.js",
                "OpenLayers/Events/buttonclick.js",
                "OpenLayers/Events/featureclick.js",
                "OpenLayers/Request.js",
                "OpenLayers/Request/XMLHttpRequest.js",
                "OpenLayers/Projection.js",
                "OpenLayers/Map.js",
                "OpenLayers/Layer.js",
                "OpenLayers/Icon.js",
                "OpenLayers/Marker.js",
                "OpenLayers/Marker/Box.js",
                "OpenLayers/Popup.js",
                "OpenLayers/Tile.js",
                "OpenLayers/Tile/Image.js",
                "OpenLayers/Tile/Image/IFrame.js",
                "OpenLayers/Tile/UTFGrid.js",
                "OpenLayers/Layer/Image.js",
                "OpenLayers/Layer/SphericalMercator.js",
                "OpenLayers/Layer/EventPane.js",
                "OpenLayers/Layer/FixedZoomLevels.js",
                "OpenLayers/Layer/Google.js",
                "OpenLayers/Layer/Google/v3.js",
                "OpenLayers/Layer/HTTPRequest.js",
                "OpenLayers/Layer/Grid.js",
                "OpenLayers/Layer/MapGuide.js",
                "OpenLayers/Layer/MapServer.js",
                "OpenLayers/Layer/KaMap.js",
                "OpenLayers/Layer/KaMapCache.js",
                "OpenLayers/Layer/Markers.js",
                "OpenLayers/Layer/Text.js",
                "OpenLayers/Layer/WorldWind.js",
                "OpenLayers/Layer/ArcGIS93Rest.js",
                "OpenLayers/Layer/WMS.js",
                "OpenLayers/Layer/WMTS.js",
                "OpenLayers/Layer/ArcIMS.js",
                "OpenLayers/Layer/GeoRSS.js",
                "OpenLayers/Layer/Boxes.js",
                "OpenLayers/Layer/XYZ.js",
                "OpenLayers/Layer/UTFGrid.js",
                "OpenLayers/Layer/OSM.js",
                "OpenLayers/Layer/Bing.js",
                "OpenLayers/Layer/TMS.js",
                "OpenLayers/Layer/TileCache.js",
                "OpenLayers/Layer/Zoomify.js",
                "OpenLayers/Layer/ArcGISCache.js",
                "OpenLayers/Popup/Anchored.js",
                "OpenLayers/Popup/Framed.js",
                "OpenLayers/Popup/FramedCloud.js",
                "OpenLayers/Feature.js",
                "OpenLayers/Feature/Vector.js",
                "OpenLayers/Handler.js",
                "OpenLayers/Handler/Click.js",
                "OpenLayers/Handler/Hover.js",
                "OpenLayers/Handler/Point.js",
                "OpenLayers/Handler/Path.js",
                "OpenLayers/Handler/Polygon.js",
                "OpenLayers/Handler/Feature.js",
                "OpenLayers/Handler/Drag.js",
                "OpenLayers/Handler/Pinch.js",
                "OpenLayers/Handler/RegularPolygon.js",
                "OpenLayers/Handler/Box.js",
                "OpenLayers/Handler/MouseWheel.js",
                "OpenLayers/Handler/Keyboard.js",
                "OpenLayers/Control.js",
                "OpenLayers/Control/Attribution.js",
                "OpenLayers/Control/Button.js",
                "OpenLayers/Control/CacheRead.js",
                "OpenLayers/Control/CacheWrite.js",
                "OpenLayers/Control/ZoomBox.js",
                "OpenLayers/Control/ZoomToMaxExtent.js",
                "OpenLayers/Control/DragPan.js",
                "OpenLayers/Control/Navigation.js",
                "OpenLayers/Control/PinchZoom.js",
                "OpenLayers/Control/TouchNavigation.js",
                "OpenLayers/Control/MousePosition.js",
                "OpenLayers/Control/OverviewMap.js",
                "OpenLayers/Control/KeyboardDefaults.js",
                "OpenLayers/Control/PanZoom.js",
                "OpenLayers/Control/PanZoomBar.js",
                "OpenLayers/Control/ArgParser.js",
                "OpenLayers/Control/Permalink.js",
                "OpenLayers/Control/Scale.js",
                "OpenLayers/Control/ScaleLine.js",
                "OpenLayers/Control/Snapping.js",
                "OpenLayers/Control/Split.js",
                "OpenLayers/Control/LayerSwitcher.js",
                "OpenLayers/Control/DrawFeature.js",
                "OpenLayers/Control/DragFeature.js",
                "OpenLayers/Control/ModifyFeature.js",
                "OpenLayers/Control/Panel.js",
                "OpenLayers/Control/SelectFeature.js",
                "OpenLayers/Control/NavigationHistory.js",
                "OpenLayers/Control/Measure.js",
                "OpenLayers/Control/WMSGetFeatureInfo.js",
                "OpenLayers/Control/WMTSGetFeatureInfo.js",
                "OpenLayers/Control/Graticule.js",
                "OpenLayers/Control/TransformFeature.js",
                "OpenLayers/Control/UTFGrid.js",
                "OpenLayers/Control/SLDSelect.js",
                "OpenLayers/Control/Zoom.js",
                "OpenLayers/Geometry.js",
                "OpenLayers/Geometry/Collection.js",
                "OpenLayers/Geometry/Point.js",
                "OpenLayers/Geometry/MultiPoint.js",
                "OpenLayers/Geometry/Curve.js",
                "OpenLayers/Geometry/LineString.js",
                "OpenLayers/Geometry/LinearRing.js",
                "OpenLayers/Geometry/Polygon.js",
                "OpenLayers/Geometry/MultiLineString.js",
                "OpenLayers/Geometry/MultiPolygon.js",
                "OpenLayers/Renderer.js",
                "OpenLayers/Renderer/Elements.js",
                "OpenLayers/Renderer/SVG.js",
                "OpenLayers/Renderer/Canvas.js",
                "OpenLayers/Renderer/VML.js",
                "OpenLayers/Layer/Vector.js",
                "OpenLayers/Layer/PointGrid.js",
                "OpenLayers/Layer/Vector/RootContainer.js",
                "OpenLayers/Strategy.js",
                "OpenLayers/Strategy/Filter.js",
                "OpenLayers/Strategy/Fixed.js",
                "OpenLayers/Strategy/Cluster.js",
                "OpenLayers/Strategy/Paging.js",
                "OpenLayers/Strategy/BBOX.js",
                "OpenLayers/Strategy/Save.js",
                "OpenLayers/Strategy/Refresh.js",
                "OpenLayers/Filter.js",
                "OpenLayers/Filter/FeatureId.js",
                "OpenLayers/Filter/Logical.js",
                "OpenLayers/Filter/Comparison.js",
                "OpenLayers/Filter/Spatial.js",
                "OpenLayers/Filter/Function.js",               
                "OpenLayers/Protocol.js",
                "OpenLayers/Protocol/HTTP.js",
                "OpenLayers/Protocol/WFS.js",
                "OpenLayers/Protocol/WFS/v1.js",
                "OpenLayers/Protocol/WFS/v1_0_0.js",
                "OpenLayers/Protocol/WFS/v1_1_0.js",
                "OpenLayers/Protocol/CSW.js",
                "OpenLayers/Protocol/CSW/v2_0_2.js",
                "OpenLayers/Protocol/Script.js",
                "OpenLayers/Protocol/SOS.js",
                "OpenLayers/Protocol/SOS/v1_0_0.js",
                "OpenLayers/Layer/PointTrack.js",
                "OpenLayers/Style.js",
                "OpenLayers/Style2.js",
                "OpenLayers/StyleMap.js",
                "OpenLayers/Rule.js",
                "OpenLayers/Format.js",
                "OpenLayers/Format/QueryStringFilter.js",
                "OpenLayers/Format/XML.js",
                "OpenLayers/Format/XML/VersionedOGC.js",
                "OpenLayers/Format/Context.js",
                "OpenLayers/Format/ArcXML.js",
                "OpenLayers/Format/ArcXML/Features.js",
                "OpenLayers/Format/GML.js",
                "OpenLayers/Format/GML/Base.js",
                "OpenLayers/Format/GML/v2.js",
                "OpenLayers/Format/GML/v3.js",
                "OpenLayers/Format/Atom.js",
                "OpenLayers/Format/EncodedPolyline.js",
                "OpenLayers/Format/KML.js",
                "OpenLayers/Format/GeoRSS.js",
                "OpenLayers/Format/WFS.js",
                "OpenLayers/Format/OWSCommon.js",
                "OpenLayers/Format/OWSCommon/v1.js",
                "OpenLayers/Format/OWSCommon/v1_0_0.js",
                "OpenLayers/Format/OWSCommon/v1_1_0.js",
                "OpenLayers/Format/WCSCapabilities.js",
                "OpenLayers/Format/WCSCapabilities/v1.js",
                "OpenLayers/Format/WCSCapabilities/v1_0_0.js",
                "OpenLayers/Format/WCSCapabilities/v1_1_0.js",
                "OpenLayers/Format/WFSCapabilities.js",
                "OpenLayers/Format/WFSCapabilities/v1.js",
                "OpenLayers/Format/WFSCapabilities/v1_0_0.js",
                "OpenLayers/Format/WFSCapabilities/v1_1_0.js",
                "OpenLayers/Format/WFSDescribeFeatureType.js",
                "OpenLayers/Format/WMSDescribeLayer.js",
                "OpenLayers/Format/WMSDescribeLayer/v1_1.js",
                "OpenLayers/Format/WKT.js",
                "OpenLayers/Format/CQL.js",
                "OpenLayers/Format/OSM.js",
                "OpenLayers/Format/GPX.js",
                "OpenLayers/Format/Filter.js",
                "OpenLayers/Format/Filter/v1.js",
                "OpenLayers/Format/Filter/v1_0_0.js",
                "OpenLayers/Format/Filter/v1_1_0.js",
                "OpenLayers/Format/SLD.js",
                "OpenLayers/Format/SLD/v1.js",
                "OpenLayers/Format/SLD/v1_0_0.js",
                "OpenLayers/Format/SLD/v1_0_0_GeoServer.js",
                "OpenLayers/Format/OWSCommon.js",
                "OpenLayers/Format/OWSCommon/v1.js",
                "OpenLayers/Format/OWSCommon/v1_0_0.js",
                "OpenLayers/Format/OWSCommon/v1_1_0.js",
                "OpenLayers/Format/CSWGetDomain.js",
                "OpenLayers/Format/CSWGetDomain/v2_0_2.js",
                "OpenLayers/Format/CSWGetRecords.js",
                "OpenLayers/Format/CSWGetRecords/v2_0_2.js",
                "OpenLayers/Format/WFST.js",
                "OpenLayers/Format/WFST/v1.js",
                "OpenLayers/Format/WFST/v1_0_0.js",
                "OpenLayers/Format/WFST/v1_1_0.js",
                "OpenLayers/Format/Text.js",
                "OpenLayers/Format/JSON.js",
                "OpenLayers/Format/GeoJSON.js",
                "OpenLayers/Format/WMC.js",
                "OpenLayers/Format/WMC/v1.js",
                "OpenLayers/Format/WMC/v1_0_0.js",
                "OpenLayers/Format/WMC/v1_1_0.js",
                "OpenLayers/Format/WCSGetCoverage.js",
                "OpenLayers/Format/WMSCapabilities.js",
                "OpenLayers/Format/WMSCapabilities/v1.js",
                "OpenLayers/Format/WMSCapabilities/v1_1.js",
                "OpenLayers/Format/WMSCapabilities/v1_1_0.js",
                "OpenLayers/Format/WMSCapabilities/v1_1_1.js",
                "OpenLayers/Format/WMSCapabilities/v1_3.js",
                "OpenLayers/Format/WMSCapabilities/v1_3_0.js",
                "OpenLayers/Format/WMSCapabilities/v1_1_1_WMSC.js",
                "OpenLayers/Format/WMSGetFeatureInfo.js",
                "OpenLayers/Format/SOSCapabilities.js",
                "OpenLayers/Format/SOSCapabilities/v1_0_0.js",
                "OpenLayers/Format/SOSGetFeatureOfInterest.js",
                "OpenLayers/Format/SOSGetObservation.js",
                "OpenLayers/Format/OWSContext.js",
                "OpenLayers/Format/OWSContext/v0_3_1.js",
                "OpenLayers/Format/WMTSCapabilities.js",
                "OpenLayers/Format/WMTSCapabilities/v1_0_0.js",
                "OpenLayers/Format/WPSCapabilities.js",
                "OpenLayers/Format/WPSCapabilities/v1_0_0.js",
                "OpenLayers/Format/WPSDescribeProcess.js",
                "OpenLayers/Format/WPSExecute.js",
                "OpenLayers/Format/XLS.js",
                "OpenLayers/Format/XLS/v1.js",
                "OpenLayers/Format/XLS/v1_1_0.js",
                "OpenLayers/Format/OGCExceptionReport.js",
                "OpenLayers/Control/GetFeature.js",
                "OpenLayers/Control/NavToolbar.js",
                "OpenLayers/Control/PanPanel.js",
                "OpenLayers/Control/Pan.js",
                "OpenLayers/Control/ZoomIn.js",
                "OpenLayers/Control/ZoomOut.js",
                "OpenLayers/Control/ZoomPanel.js",
                "OpenLayers/Control/EditingToolbar.js",
                "OpenLayers/Control/Geolocate.js",
                "OpenLayers/Symbolizer.js",
                "OpenLayers/Symbolizer/Point.js",
                "OpenLayers/Symbolizer/Line.js",
                "OpenLayers/Symbolizer/Polygon.js",
                "OpenLayers/Symbolizer/Text.js",
                "OpenLayers/Symbolizer/Raster.js",
                "OpenLayers/Lang.js",
                "OpenLayers/Lang/en.js",
                "OpenLayers/Spherical.js",
                "OpenLayers/TileManager.js",
                "OpenLayers/WPSClient.js",
                "OpenLayers/WPSProcess.js"
            ]; // etc.
        }

// use "parser-inserted scripts" for guaranteed execution order
        // http://hsivonen.iki.fi/script-execution/
        var scriptTags = new Array(jsFiles.length);
        var host = OpenLayers._getScriptLocation() + "lib/";
        for (var i=0, len=jsFiles.length; i<len; i++) {
            scriptTags[i] = "<script src=‘" + host + jsFiles[i] +
                                   "‘></script>";
        }
        if (scriptTags.length > 0) {
            document.write(scriptTags.join(""));
        }
    }
})();

/**
* Constant: VERSION_NUMBER
*
* This constant identifies the version of OpenLayers.
*
* When asking questions or reporting issues, make sure to include the output of
*     OpenLayers.VERSION_NUMBER in the question or issue-description.
*/
OpenLayers.VERSION_NUMBER="Release 2.13.1";

时间: 2024-08-04 22:55:59

openlayers研究(一) 初始化流程的相关文章

SylixOS CAN总线初始化流程解析

概述 本文档是在AT91SAM9X25平台上进行SylixOS CAN总线驱动开发时,对CAN总线初始化流程的分析. 适用于正在学习CAN总线开发的技术工程师. 技术实现 CAN总线的初始化流程可以分成两个部分: 一部分是CAN总线通道资源初始化,主要工作是对通道相关的管脚和中断以及总线编程时需要的时钟等资源的初始化:另一部分是CAN总线的硬件初始化,主要工作是对总线的波特率的设置.接收和发送数据邮箱(相当于缓存区)的初始化以及接收中断和错误中断的使能. CAN总线通道资源初始化 在AT91SA

SpringMVC源码剖析(三)- DispatcherServlet的初始化流程

在我们第一次学Servlet编程,学Java Web的时候,还没有那么多框架.我们开发一个简单的功能要做的事情很简单,就是继承HttpServlet,根据需要重写一下doGet,doPost方法,跳转到我们定义好的jsp页面.Servlet类编写完之后在web.xml里注册这个Servlet类. 除此之外,没有其他了.我们启动web服务器,在浏览器中输入地址,就可以看到浏览器上输出我们写好的页面.为了更好的理解上面这个过程,你需要学习关于Servlet生命周期的三个阶段,就是所谓的“init-s

Android技术20:Android的初始化流程

Android系统是如何启动的呢,应用程序是如何启动.下面简要介绍下初始化流程. 1.Android系统的初始化 1.1Android系统会首先启动Linux基础系统,然后引导加载Linux内核并启动初始化进程Init Linux Kernel---->Init(pid=1) 1.2启动守护进程Daemons 启动Usb守护进程,管理USB连接 启动Android Debug Bridge守护进程管理ADB连接 启动Debuggerd Debug守护进程 启动无线接口守护进程管理无线通信 1.3

Android 6.0 SIM卡初始化流程

本文主要讲述Android 6.0 SIM卡初始化流程,这个过程也涉及到UICC框架的初始化,UICC(Universal Integrated Circuit Card)的架构图如下: /** * This class is responsible for keeping all knowledge about * Universal Integrated Circuit Card (UICC), also know as SIM's, * in the system. It is also

【开源】OSharp3.3框架解说系列(7.1):初始化流程概述

本文已同步到系列目录:OSharp快速开发框架解说系列 框架初始化 相对于OSharp 3.0,3.3版本最大的更新,就是从框架级别定义了初始化流程,对初始化功能进行了抽象与封装,不依赖于第三方实现,第三方实现仅作为可替换的服务实现方案存在. 例如,依赖注入功能中,接口与其实现类的映射配置,对象容器的构建,对象的解析获取,都将通过框架定义的API来完成,而Autofac,仅作为这些功能的实现方存在,如果不想使用Autofac,则可以很方便的切换成别的IoC组件. 具体的初始化功能是怎样抽象与定义

Raid1源代码分析--初始化流程

初始化流程代码量比较少,也比较简单.主要是run函数.(我阅读的代码的linux内核版本是2.6.32.61) 四.初始化流程分析 run函数顾名思义,很简单这就是在RAID1开始运行时调用,进行一些初始化的操作.主要是对RAID1中的conf进行初始化.run函数在md.c的do_md_run中被调用.   run函数的具体流程 0.传入参数mddev就是指RAID1所处的MD设备. 1.  定义相关变量. 1.1  定义conf指针,类型为raid1_private_data_s,是raid

深入浅出高性能服务发现、配置框架Nacos系列 3: 服务发现:Nacos客户端初始化流程

上一章节,我们从全局了解了一下Nacos项目的模块架构,做到了心中有数,现在,我们去逐步去挖掘里面的代码细节,很多人在学习开源的时候,无从下手,代码那么多,从哪个地方开始看呢?我们可以从一个接口开始入手,这个接口是你使用过的,知道它大概做什么事,有体感的,大家还记得第一章时,我们写的HelloWorld吗,对,就从里面的接口开始剥洋葱. 这个是Nacos的github代码地址,开始之前先start关注一下,加上watch,后续Nacos的邮件列表也会通知到你,可以关注到Nacos的最新实时消息,

关于Flutter初始化流程,我必须告诉你的是...

1. 引言 最近在做性能优化的时候发现,在混合栈开发中,第一次启动Flutter页面的耗时总会是第二次启动Flutter页面耗时的两倍左右,这样给人感觉很不好.分析发现第一次启动Flutter页面会做一些初始化工作,借此,我梳理了下Flutter的初始化流程. 2. Flutter初始化时序 Flutter初始化主要分四部分,FlutterMain初始化.FlutterNativeView初始化.FlutterView初始化和Flutter Bundle初始化.我们先看下Flutter初始化的时

Spring IOC容器的初始化流程

IOC初始化流程 Resource定位:指对BeanDefinition的资源定位过程.Bean 可能定义在XML中,或者是一个注解,或者是其他形式.这些都被用Resource来定位, 读取Resource获取BeanDefinition 并注册到 Bean定义注册表中. BeanDefinition的载入:把用户定义好的Javabean表示为IoC容器内部的数据结构,这个容器内部的数据结构就是BeanDefinition. 向IoC容器注册这些BeanDefinition. 获取Bean的流程