当前位置: 首页 > news >正文

中国建设银行个人网站银行企业网站建设合同电子版

中国建设银行个人网站银行,企业网站建设合同电子版,做一个手机app大概需要多少钱,什么网站做的好看的给自己的每日一句 不从恶人的计谋#xff0c;不站罪人的道路#xff0c;不坐亵慢人的座位#xff0c;惟喜爱耶和华的律法#xff0c;昼夜思想#xff0c;这人便为有福#xff01;他要像一棵树栽在溪水旁#xff0c;按时候结果子#xff0c;叶子也不枯干。凡他所做的尽…给自己的每日一句 不从恶人的计谋不站罪人的道路不坐亵慢人的座位惟喜爱耶和华的律法昼夜思想这人便为有福他要像一棵树栽在溪水旁按时候结果子叶子也不枯干。凡他所做的尽都顺利 本文内容整理自《孙哥说Mybatis系列课程》 Cache是在什么时候、什么地点被创建的 不管是我们使用Mybatis写测试程序还是在真实企业级项目中使用MybatisMybatis框架被启动加载的前几行代码一定是如下 InputStream inputStream Resources.getResourceAsStream(mybatis-config.xml);SqlSessionFactory sqlSessionFactory new SqlSessionFactoryBuilder().build(inputStream);SqlSession sqlSession sqlSessionFactory.openSession();然后我们的二级缓存Cache对象就是在这个期间也就是Mybatis被启动和初始化的时候完成的那么我们就详细展开吧。 首先我要告诉大家的是这个过程一定是在SqlSessionFactory工厂被创建的时候完成的那就是上述的第二行代码并且这里应用的是构建者设计模式这个精华必须隐藏在build()方法中我们查看一下 public SqlSessionFactory build(InputStream inputStream) {return build(inputStream, null, null);}//重载的build方法真正的精华是在这里public SqlSessionFactory build(InputStream inputStream, String environment, Properties properties) {try {//将Mybatis和核心配置文件读取成inputStream之后我们有将他转换成Mybatis中重要的//XMLConfigBuilder对象XMLConfigBuilder parser new XMLConfigBuilder(inputStream, environment, properties);return build(parser.parse());} catch (Exception e) {throw ExceptionFactory.wrapException(Error building SqlSession., e);} finally {ErrorContext.instance().reset();try {inputStream.close();} catch (IOException e) {// Intentionally ignore. Prefer previous error.}}}return build(parser.parse());这里边硬货就多了build方法就是为了创建 public SqlSessionFactory build(Configuration config) {return new DefaultSqlSessionFactory(config);}所以里边的parser.parse()的返回值一定是生成的Configuration对象原材料就是Mybatis核心配置文件读取到的InputStream有因为InputStream当中记录了Mapper.xml的路径所以这些Mapper文件必定也是在这里边解析的。 public Configuration parse() {if (parsed) {throw new BuilderException(Each XMLConfigBuilder can only be used once.);}parsed true;parseConfiguration(parser.evalNode(/configuration));return configuration;}parser.evalNode(“/configuration”)兄弟们这玩意用脚趾头都知道这读的是mybatis-config.xml里边的Configuration标签这样就把mybatis-config.xml整个文件作为一个Node对象被放到了parseConfiguration方法当中这个方法的目的从方法上就能看出来为了构建Configuration对象 private void parseConfiguration(XNode root) {try {//issue #117 read properties firstpropertiesElement(root.evalNode(properties));Properties settings settingsAsProperties(root.evalNode(settings));loadCustomVfs(settings);typeAliasesElement(root.evalNode(typeAliases));pluginElement(root.evalNode(plugins));objectFactoryElement(root.evalNode(objectFactory));objectWrapperFactoryElement(root.evalNode(objectWrapperFactory));reflectorFactoryElement(root.evalNode(reflectorFactory));settingsElement(settings);// read it after objectFactory and objectWrapperFactory issue #631environmentsElement(root.evalNode(environments));databaseIdProviderElement(root.evalNode(databaseIdProvider));typeHandlerElement(root.evalNode(typeHandlers));mapperElement(root.evalNode(mappers));} catch (Exception e) {throw new BuilderException(Error parsing SQL Mapper Configuration. Cause: e, e);}}兄弟们眼熟了吧这不就是mybatis-config.xml里边的一个一个的标签么一个一个的排队解析看最后一行这玩意里边存储的不就是Mapper标签么所以Mapper.xml必定就是在这里边解析的再加上我们知道Cache标签是写在Mapper.xml里边的所以Cache对象必是在里边创建的。 private void mapperElement(XNode parent) throws Exception {if (parent ! null) {for (XNode child : parent.getChildren()) {if (package.equals(child.getName())) {String mapperPackage child.getStringAttribute(name);configuration.addMappers(mapperPackage);} else {String resource child.getStringAttribute(resource);String url child.getStringAttribute(url);String mapperClass child.getStringAttribute(class);if (resource ! null url null mapperClass null) {ErrorContext.instance().resource(resource);InputStream inputStream Resources.getResourceAsStream(resource);XMLMapperBuilder mapperParser new XMLMapperBuilder(inputStream, configuration, resource, configuration.getSqlFragments());mapperParser.parse();} else if (resource null url ! null mapperClass null) {ErrorContext.instance().resource(url);InputStream inputStream Resources.getUrlAsStream(url);XMLMapperBuilder mapperParser new XMLMapperBuilder(inputStream, configuration, url, configuration.getSqlFragments());mapperParser.parse();} else if (resource null url null mapperClass ! null) {Class? mapperInterface Resources.classForName(mapperClass);configuration.addMapper(mapperInterface);} else {throw new BuilderException(A mapper element may only specify a url, resource or class, but not more than one.);}}}}} 兄弟们XMLMapperBuilder mapperParser new XMLMapperBuilder(inputStream, configuration, resource, configuration.getSqlFragments());这玩意不就是在读Mapper.xml文件么mapperParser.parse();又去parse去了我们进去看看 public void parse() {if (!configuration.isResourceLoaded(resource)) {configurationElement(parser.evalNode(/mapper));configuration.addLoadedResource(resource);bindMapperForNamespace();}parsePendingResultMaps();parsePendingCacheRefs();parsePendingStatements();}configurationElement兄弟们看到名字还不明白么这是在解析Mapper.xml当中的元素解析到Configurantion对象当中呀Cache标签也是其中的一个元素呀 private void configurationElement(XNode context) {try {String namespace context.getStringAttribute(namespace);if (namespace null || namespace.equals()) {throw new BuilderException(Mappers namespace cannot be empty);}builderAssistant.setCurrentNamespace(namespace);cacheRefElement(context.evalNode(cache-ref));cacheElement(context.evalNode(cache));parameterMapElement(context.evalNodes(/mapper/parameterMap));resultMapElements(context.evalNodes(/mapper/resultMap));sqlElement(context.evalNodes(/mapper/sql));buildStatementFromContext(context.evalNodes(select|insert|update|delete));} catch (Exception e) {throw new BuilderException(Error parsing Mapper XML. The XML location is resource . Cause: e, e);}} private void cacheElement(XNode context) throws Exception {if (context ! null) {String type context.getStringAttribute(type, PERPETUAL);Class? extends Cache typeClass typeAliasRegistry.resolveAlias(type);String eviction context.getStringAttribute(eviction, LRU);Class? extends Cache evictionClass typeAliasRegistry.resolveAlias(eviction);Long flushInterval context.getLongAttribute(flushInterval);Integer size context.getIntAttribute(size);boolean readWrite !context.getBooleanAttribute(readOnly, false);boolean blocking context.getBooleanAttribute(blocking, false);Properties props context.getChildrenAsProperties();builderAssistant.useNewCache(typeClass, evictionClass, flushInterval, size, readWrite, blocking, props);}}兄弟们到这里基本上知道在哪里创建的吧至于怎么创建咱们后期出文章玩~
http://www.w-s-a.com/news/285025/

相关文章:

  • 怎么取网页视频网站元素计算机专业论文网站开发
  • 上海网站建设备案号怎么恢复wordpress打开页面空白
  • 30个做设计的网站企业设计网站
  • 招生网站开发的背景创意 wordpress
  • 网站备案资料查询小型企业管理系统软件
  • 温州网站建设维护怎么做好网站开发、设计
  • 佛山 做网站公司有哪些网站排名忽然不见了
  • 广告网站建设最专业东莞大朗网站设计
  • 网站做流量的论坛贴吧分销商城系统源码
  • 新手建立网站的步骤网站建设费怎么入分录
  • 哪里建网站性价比高做网站赚取广告费
  • 邢台集团网站建设价格微信怎么做捐钱的网站
  • 做网站费用需要分摊吗装修公司一般多少钱一平方
  • 公司主页的网站格式wordpress自动推送给百度
  • 网站建设辶金手指排名十二wordpress 当数据库
  • 无锡手机网站建设服务苏州展厅设计企业
  • 无锡网站制作需要多少钱北京二次感染最新消息
  • 网站开发视频播放无画面杭州房产信息网官网
  • 网站开发 改进如何创建公众号平台
  • wordpress网站响应很慢只有asp网站代码可以重新编译吗
  • 哪个网站教做饭做的好wordpress热点文章
  • 可以做推广东西的网站重庆网站建设 重庆网站制作
  • 珠海网站建设培训学校wordpress去版权 合法
  • 建设食品商购网站学校网站设计实验报告
  • 建个网站多少钱沭阳奥体小区做网站的
  • 广州视频网站建站公司php网页设计作业代码
  • 成都公司网站设计如何制作网址最简单的方法
  • 温州 做网站福建住房城乡建设部网站
  • 网站自动化采集成都网站设计费用
  • 广东专业网站定制建设淘宝网站的人员组织结构