Spring研究-容器初始化之FileSystemXmlApplicationContext构造函数

Spring 中FileSystemXmlApplicationContext 是 Spring Framework 中的一个重要类,位于包中。它是接口的实现,专门用于从文件系统中的 XML 配置文件加载 Spring bean 定义。与不同,它允许开发者从文件系统的任何路径访问配置文件,不仅限于类路径。 阅读详情

全文详见个人博客:https://www.coderli.com/spring-filexml-constructor/Spring研究-容器初始化之FileSystemXmlApplicationContext构造函数宅男Coder,没有其他爱好,闲暇之余抱着瞻仰的心态去阅读一下Spring的源码,期许能收获一支半解。要学习Spring的源码,第一步自然是下载和编译Spring的源码,这个我在之前的博文中已经发表过了。具体可参考:《SpringFramework源码下载和编译教程》 面对茫茫多的Spring的工程和代码,很多人可能会无从下手。其实想想,Spring也是有入口的,那就是配置文件的加载。Spring容器的构建完全是基于配置文件的配置的。不论是Web工程,还是普通的Java应用,加载Spring配置文件都是首要的工作。所以,我就从配置文件的加载学起。 要加载配置文件,首先当然是要找到该文件。大多数人通常都是在Web应用中使用Spring。网上搜搜配置,配置文件的名字就叫约定的:applicationContext.xml,然后往编译路径下一扔,Spring自然就好用了,就没过多的关注过其他容器初始化的问题。其实,一个自然应该想到的问题就是:一个普通的J2SE应用该如何使用Spring呢?答案很简单:new 出一个ApplicationContext的实例就好了。例如: private static final String SPRINT_FILEPATH_CONTEXT = "D:\\workspace-home\\OpenSourceStudy\\src\\main\\resources\\spring\\app-context.xml"; ApplicationContext appContext = new FileSystemXmlApplicationContext( SPRINT_FILEPATH_CONTEXT); 只需上述一行代码,一个基于指定的配置文件的Spring容器就初始化完成了。 下面,我们来仔细看看FileSystemXmlApplicationContext这个类: public class FileSystemXmlApplicationContext extends AbstractXmlApplicationContext { /** * Create a new FileSystemXmlApplicationContext for bean-style configuration. * @see #setConfigLocation * @see #setConfigLocations * @see #afterPropertiesSet() */ public FileSystemXmlApplicationContext() { } /** * Create a new FileSystemXmlApplicationContext for bean-style configuration. * @param parent the parent context * @see #setConfigLocation * @see #setConfigLocations * @see #afterPropertiesSet() */ public FileSystemXmlApplicationContext(ApplicationContext parent) { super(parent); } /** * Create a new FileSystemXmlApplicationContext, loading the definitions * from the given XML file and automatically refreshing the context. * @param configLocation file path * @throws BeansException if context creation failed */ public FileSystemXmlApplicationContext(String configLocation) throws BeansException { this(new String[] {configLocation}, true, null); } /** * Create a new FileSystemXmlApplicationContext, loading the definitions * from the given XML files and automatically refreshing the context. * @param configLocations array of file paths * @throws BeansException if context creation failed */ public FileSystemXmlApplicationContext(String... configLocations) throws BeansException { this(configLocations, true, null); } /** * Create a new FileSystemXmlApplicationContext with the given parent, * loading the definitions from the given XML files and automatically * refreshing the context. * @param configLocations array of file paths * @param parent the parent context * @throws BeansException if context creation failed */ public FileSystemXmlApplicationContext(String[] configLocations, ApplicationContext parent) throws BeansException { this(configLocations, true, parent); } /** * Create a new FileSystemXmlApplicationContext, loading the definitions * from the given XML files. * @param configLocations array of file paths * @param refresh whether to automatically refresh the context, * loading all bean definitions and creating all singletons. * Alternatively, call refresh manually after further configuring the context. * @throws BeansException if context creation failed * @see #refresh() */ public FileSystemXmlApplicationContext(String[] configLocations, boolean refresh) throws BeansException { this(configLocations, refresh, null); } /** * Create a new FileSystemXmlApplicationContext with the given parent, * loading the definitions from the given XML files. * @param configLocations array of file paths * @param refresh whether to automatically refresh the context, * loading all bean definitions and creating all singletons. * Alternatively, call refresh manually after further configuring the context. * @param parent the parent context * @throws BeansException if context creation failed * @see #refresh() */ public FileSystemXmlApplicationContext(String[] configLocations, boolean refresh, ApplicationContext parent) throws BeansException { super(parent); setConfigLocations(configLocations); if (refresh) { refresh(); } } /** * Resolve resource paths as file system paths. * <p>Note: Even if a given path starts with a slash, it will get * interpreted as relative to the current VM working directory. * This is consistent with the semantics in a Servlet container. * @param path path to the resource * @return Resource handle * @see org.springframework.web.context.support.XmlWebApplicationContext#getResourceByPath */ @Override protected Resource getResourceByPath(String path) { if (path != null &amp;&amp; path.startsWith("/")) { path = path.substring(1); } return new FileSystemResource(path); } } 一共七个构造函数和一个复写的方法。我们现在重点关注构造函数,除前两个之外,其他的构造函数都最终指向构造函数 public FileSystemXmlApplicationContext(String[] configLocations, boolean refresh, ApplicationContext parent) throws BeansException { super(parent); setConfigLocations(configLocations); if (refresh) { refresh(); } 只是对没有传入的参数,给了一个默认值。 该构造函数有三个参数: String[] configLocations - 配置文件的路径数组。是数组也就是说,支持同时传入多个配置文件路径。 boolean refresh - 是否刷新,如果是true,则会开始初始化Spring容器, false则暂时不初始化Spring容器。 ApplicationContext parent - Spring容器上下文。即可以传入已经初始化过的Spring容器,新初始化的容器会包含parent上下文中的内容,例如:父容器中定义的bean等。 refresh()方法可谓Spring的核心的入口函数,Spring容器的初始化正是由此开始。一些Spring学习的书中,也向学习Spring的读者推荐,如果感到无所适从,可从该方法入手,研究Spring的整个生命周期。后续我们也会从该方法入手重点研究。现在只需理解,其为Spring容器初始化的一个“开关”即可。 前两个构造函数与该构造函数最大的区别就是,没有调用refresh函数。也就是说,Spring容器,此时并未初始化。此时如果用getBean方法去获取Bean的实例,会报容器并未初始化的异常。 下面给出一些关于构造函数的测试用例,能更直观、具体的说明问题 private String filePath = "D:\\workspace-home\\spring-custom\\src\\main\\resources\\spring\\app-context.xml"; private String parentFilePath = "D:\\workspace-home\\spring-custom\\src\\main\\resources\\spring\\parent-context.xml"; /** * 直接指定一个单一的配置文件初始化Spring容器。容器中包含该指定配置文件中定义的Bean{@code VeryCommonBean}。 * * @author lihzh * @date 2012-4-29 下午9:39:27 */ @Test public void testFileContextWithPath() { ApplicationContext appContext = new FileSystemXmlApplicationContext( filePath); assertNotNull("The app context should not be null.", appContext); assertNotNull(appContext.getBean(VeryCommonBean.class)); } /** * 将已经初始化好的Spring容器上下文传递给新的Spring容器。需手动调用容器的刷新 * {@code ConfigurableApplicationContext#refresh()}(初始化)。 * * @author lihzh * @date 2012-5-4 下午9:28:40 */ @Test public void testFileContextWithParentOnly() { ApplicationContext parentContext = new FileSystemXmlApplicationContext( parentFilePath); ConfigurableApplicationContext appContext = new FileSystemXmlApplicationContext( parentContext); assertNotNull("The parent context should not be null.", parentContext); assertNotNull(appContext); // 需要手动刷新(初始化)容器 appContext.refresh(); assertNotNull(parentContext.getBean(ParentBean.class)); assertNotNull(appContext.getBean(ParentBean.class)); } /** * 根据指定的配置文件和已经初始化好的Parent容器上下文,实例化一个新的Spring容器,该容器中包含这两部分的信息。 * * @author lihzh * @date 2012-5-4 下午10:07:20 */ @Test public void testFileContextWithParentAndItself() { ApplicationContext parentContext = new FileSystemXmlApplicationContext( parentFilePath); ApplicationContext appContext = new FileSystemXmlApplicationContext( new String[] { filePath }, parentContext); assertNotNull("The parent context should not be null", parentContext); assertNotNull(appContext); assertTrue("Should not have bean:[VeryCommonBean] in parent context.", !parentContext.containsBean("VeryCommonBean")); assertNotNull(parentContext.getBean(ParentBean.class)); assertNotNull(appContext.getBean(ParentBean.class)); assertNotNull("Should have bean:[VeryCommonBean].", appContext.getBean("VeryCommonBean")); } /** * 同时指定多个配置文件来初始化Spring容器 * * @author lihzh * @date 2012-5-4 下午10:09:02 */ @Test public void testFileContextWithMultiPath() { ApplicationContext appContext = new FileSystemXmlApplicationContext( parentFilePath, filePath); assertNotNull(appContext); assertNotNull(appContext.getBean(ParentBean.class)); assertNotNull("Should have bean:[VeryCommonBean].", appContext.getBean(VeryCommonBean.class)); } 了解这些有什么用? 学会在一个普通的J2SE应用中使用Spring,初始化Spring容器。 了解初始化Spring容器的几种方式和传入的参数,可配合不同的场景使用。例如:在程序运行期动态初始化一个新的Spring容器,包含已经初始化的容器,即可用与parent相关的构造函数。再例如:在可能的特定的场景下,Spring容器需要在特定的实际初始化,可先调用空构造函数,再传入location,再手动refresh。或者直接给refresh传入false,再手动refresh。再比如:配合Spring的foo包,可监控Spring配置文件的变化,利用refresh函数,实时更新Spring容器等等。icon-default.png?t=N7T8https://www.coderli.com/spring-filexml-constructor/交流探讨,加入群聊【Java学习交流(982860385)】

闲暇之余抱着瞻仰的心态去阅读一下Spring的源码,期许能收获一支半解。要学习Spring的源码,第一步自然是下载和编译Spring的源码,这个我在之前的博文中已经发表过了。具体可参考:《SpringFramework源码下载和编译教程》

面对茫茫多的Spring的工程和代码,很多人可能会无从下手。其实想想,Spring也是有入口的,那就是配置文件的加载。Spring容器的构建完全是基于配置文件的配置的。不论是Web工程,还是普通的Java应用,加载Spring配置文件都是首要的工作。所以,我就从配置文件的加载学起。

要加载配置文件,首先当然是要找到该文件。大多数人通常都是在Web应用中使用Spring。网上搜搜配置,配置文件的名字就叫约定的:applicationContext.xml,然后往编译路径下一扔,Spring自然就好用了,就没过多的关注过其他容器初始化的问题。其实,一个自然应该想到的问题就是:一个普通的J2SE应用该如何使用Spring呢?答案很简单:new 出一个ApplicationContext的实例就好了。例如:

private static final String SPRINT_FILEPATH_CONTEXT = "D:\\workspace-home\\OpenSourceStudy\\src\\main\\resources\\spring\\app-context.xml";          
	ApplicationContext  appContext = new FileSystemXmlApplicationContext(
				SPRINT_FILEPATH_CONTEXT);

只需上述一行代码,一个基于指定的配置文件的Spring容器就初始化完成了。

下面,我们来仔细看看FileSystemXmlApplicationContext这个类:

全文详见个人博客:https://www.coderli.com/spring-filexml-constructor/

Spring研究-容器初始化之FileSystemXmlApplicationContext构造函数宅男Coder,没有其他爱好,闲暇之余抱着瞻仰的心态去阅读一下Spring的源码,期许能收获一支半解。要学习Spring的源码,第一步自然是下载和编译Spring的源码,这个我在之前的博文中已经发表过了。具体可参考:《SpringFramework源码下载和编译教程》 面对茫茫多的Spring的工程和代码,很多人可能会无从下手。其实想想,Spring也是有入口的,那就是配置文件的加载。Spring容器的构建完全是基于配置文件的配置的。不论是Web工程,还是普通的Java应用,加载Spring配置文件都是首要的工作。所以,我就从配置文件的加载学起。 要加载配置文件,首先当然是要找到该文件。大多数人通常都是在Web应用中使用Spring。网上搜搜配置,配置文件的名字就叫约定的:applicationContext.xml,然后往编译路径下一扔,Spring自然就好用了,就没过多的关注过其他容器初始化的问题。其实,一个自然应该想到的问题就是:一个普通的J2SE应用该如何使用Spring呢?答案很简单:new 出一个ApplicationContext的实例就好了。例如: private static final String SPRINT_FILEPATH_CONTEXT = "D:\\workspace-home\\OpenSourceStudy\\src\\main\\resources\\spring\\app-context.xml"; ApplicationContext appContext = new FileSystemXmlApplicationContext( SPRINT_FILEPATH_CONTEXT); 只需上述一行代码,一个基于指定的配置文件的Spring容器就初始化完成了。 下面,我们来仔细看看FileSystemXmlApplicationContext这个类: public class FileSystemXmlApplicationContext extends AbstractXmlApplicationContext { /** * Create a new FileSystemXmlApplicationContext for bean-style configuration. * @see #setConfigLocation * @see #setConfigLocations * @see #afterPropertiesSet() */ public FileSystemXmlApplicationContext() { } /** * Create a new FileSystemXmlApplicationContext for bean-style configuration. * @param parent the parent context * @see #setConfigLocation * @see #setConfigLocations * @see #afterPropertiesSet() */ public FileSystemXmlApplicationContext(ApplicationContext parent) { super(parent); } /** * Create a new FileSystemXmlApplicationContext, loading the definitions * from the given XML file and automatically refreshing the context. * @param configLocation file path * @throws BeansException if context creation failed */ public FileSystemXmlApplicationContext(String configLocation) throws BeansException { this(new String[] {configLocation}, true, null); } /** * Create a new FileSystemXmlApplicationContext, loading the definitions * from the given XML files and automatically refreshing the context. * @param configLocations array of file paths * @throws BeansException if context creation failed */ public FileSystemXmlApplicationContext(String... configLocations) throws BeansException { this(configLocations, true, null); } /** * Create a new FileSystemXmlApplicationContext with the given parent, * loading the definitions from the given XML files and automatically * refreshing the context. * @param configLocations array of file paths * @param parent the parent context * @throws BeansException if context creation failed */ public FileSystemXmlApplicationContext(String[] configLocations, ApplicationContext parent) throws BeansException { this(configLocations, true, parent); } /** * Create a new FileSystemXmlApplicationContext, loading the definitions * from the given XML files. * @param configLocations array of file paths * @param refresh whether to automatically refresh the context, * loading all bean definitions and creating all singletons. * Alternatively, call refresh manually after further configuring the context. * @throws BeansException if context creation failed * @see #refresh() */ public FileSystemXmlApplicationContext(String[] configLocations, boolean refresh) throws BeansException { this(configLocations, refresh, null); } /** * Create a new FileSystemXmlApplicationContext with the given parent, * loading the definitions from the given XML files. * @param configLocations array of file paths * @param refresh whether to automatically refresh the context, * loading all bean definitions and creating all singletons. * Alternatively, call refresh manually after further configuring the context. * @param parent the parent context * @throws BeansException if context creation failed * @see #refresh() */ public FileSystemXmlApplicationContext(String[] configLocations, boolean refresh, ApplicationContext parent) throws BeansException { super(parent); setConfigLocations(configLocations); if (refresh) { refresh(); } } /** * Resolve resource paths as file system paths. * <p>Note: Even if a given path starts with a slash, it will get * interpreted as relative to the current VM working directory. * This is consistent with the semantics in a Servlet container. * @param path path to the resource * @return Resource handle * @see org.springframework.web.context.support.XmlWebApplicationContext#getResourceByPath */ @Override protected Resource getResourceByPath(String path) { if (path != null &amp;&amp; path.startsWith("/")) { path = path.substring(1); } return new FileSystemResource(path); } } 一共七个构造函数和一个复写的方法。我们现在重点关注构造函数,除前两个之外,其他的构造函数都最终指向构造函数 public FileSystemXmlApplicationContext(String[] configLocations, boolean refresh, ApplicationContext parent) throws BeansException { super(parent); setConfigLocations(configLocations); if (refresh) { refresh(); } 只是对没有传入的参数,给了一个默认值。 该构造函数有三个参数: String[] configLocations - 配置文件的路径数组。是数组也就是说,支持同时传入多个配置文件路径。 boolean refresh - 是否刷新,如果是true,则会开始初始化Spring容器, false则暂时不初始化Spring容器。 ApplicationContext parent - Spring容器上下文。即可以传入已经初始化过的Spring容器,新初始化的容器会包含parent上下文中的内容,例如:父容器中定义的bean等。 refresh()方法可谓Spring的核心的入口函数,Spring容器的初始化正是由此开始。一些Spring学习的书中,也向学习Spring的读者推荐,如果感到无所适从,可从该方法入手,研究Spring的整个生命周期。后续我们也会从该方法入手重点研究。现在只需理解,其为Spring容器初始化的一个“开关”即可。 前两个构造函数与该构造函数最大的区别就是,没有调用refresh函数。也就是说,Spring容器,此时并未初始化。此时如果用getBean方法去获取Bean的实例,会报容器并未初始化的异常。 下面给出一些关于构造函数的测试用例,能更直观、具体的说明问题 private String filePath = "D:\\workspace-home\\spring-custom\\src\\main\\resources\\spring\\app-context.xml"; private String parentFilePath = "D:\\workspace-home\\spring-custom\\src\\main\\resources\\spring\\parent-context.xml"; /** * 直接指定一个单一的配置文件初始化Spring容器。容器中包含该指定配置文件中定义的Bean{@code VeryCommonBean}。 * * @author lihzh * @date 2012-4-29 下午9:39:27 */ @Test public void testFileContextWithPath() { ApplicationContext appContext = new FileSystemXmlApplicationContext( filePath); assertNotNull("The app context should not be null.", appContext); assertNotNull(appContext.getBean(VeryCommonBean.class)); } /** * 将已经初始化好的Spring容器上下文传递给新的Spring容器。需手动调用容器的刷新 * {@code ConfigurableApplicationContext#refresh()}(初始化)。 * * @author lihzh * @date 2012-5-4 下午9:28:40 */ @Test public void testFileContextWithParentOnly() { ApplicationContext parentContext = new FileSystemXmlApplicationContext( parentFilePath); ConfigurableApplicationContext appContext = new FileSystemXmlApplicationContext( parentContext); assertNotNull("The parent context should not be null.", parentContext); assertNotNull(appContext); // 需要手动刷新(初始化)容器 appContext.refresh(); assertNotNull(parentContext.getBean(ParentBean.class)); assertNotNull(appContext.getBean(ParentBean.class)); } /** * 根据指定的配置文件和已经初始化好的Parent容器上下文,实例化一个新的Spring容器,该容器中包含这两部分的信息。 * * @author lihzh * @date 2012-5-4 下午10:07:20 */ @Test public void testFileContextWithParentAndItself() { ApplicationContext parentContext = new FileSystemXmlApplicationContext( parentFilePath); ApplicationContext appContext = new FileSystemXmlApplicationContext( new String[] { filePath }, parentContext); assertNotNull("The parent context should not be null", parentContext); assertNotNull(appContext); assertTrue("Should not have bean:[VeryCommonBean] in parent context.", !parentContext.containsBean("VeryCommonBean")); assertNotNull(parentContext.getBean(ParentBean.class)); assertNotNull(appContext.getBean(ParentBean.class)); assertNotNull("Should have bean:[VeryCommonBean].", appContext.getBean("VeryCommonBean")); } /** * 同时指定多个配置文件来初始化Spring容器 * * @author lihzh * @date 2012-5-4 下午10:09:02 */ @Test public void testFileContextWithMultiPath() { ApplicationContext appContext = new FileSystemXmlApplicationContext( parentFilePath, filePath); assertNotNull(appContext); assertNotNull(appContext.getBean(ParentBean.class)); assertNotNull("Should have bean:[VeryCommonBean].", appContext.getBean(VeryCommonBean.class)); } 了解这些有什么用? 学会在一个普通的J2SE应用中使用Spring,初始化Spring容器。 了解初始化Spring容器的几种方式和传入的参数,可配合不同的场景使用。例如:在程序运行期动态初始化一个新的Spring容器,包含已经初始化的容器,即可用与parent相关的构造函数。再例如:在可能的特定的场景下,Spring容器需要在特定的实际初始化,可先调用空构造函数,再传入location,再手动refresh。或者直接给refresh传入false,再手动refresh。再比如:配合Spring的foo包,可监控Spring配置文件的变化,利用refresh函数,实时更新Spring容器等等。icon-default.png?t=N7T8https://www.coderli.com/spring-filexml-constructor/

PredFormer实战:用Transformer搞定交通流量预测(附TaxiBJ数据集代码) 本文详细介绍了如何利用PredFormer这一基于Transformer的先进模型进行交通流量预测,特别针对TaxiBJ数据集提供了完整的实战代码和优化策略。PredFormer通过门控Transformer块(GTB)的创新设计,在时空预测任务中展现出显著优势,相比传统方法将MSE降低33.1%,推理速度提升4.4倍。文章还涵盖了模型轻量化、部署优化等实用技巧,为智慧城市建设中的交通预测提供了高效解决方案。 阅读详情

相关推荐

手把手教你用CubeMX给GD32F103点灯、调串口(附完整工程)

本文详细介绍了如何使用CubeMX为GD32F103开发板配置GPIO点灯和串口通信,包含完整的工程创建、代码构建和测试流程。特别强调了GD32与STM32的差异点及常见避坑技巧,帮助开发者快速上手GD32开发。

weixin_42566424的博客 313

Spring源码学习-容器初始化之FileSystemXmlApplicationContext(一)构造函数

宅男Coder,没有其他爱好,闲暇之余抱着瞻仰的心态去阅读一下Spring的源码,期许能收获一支半解。要学习Spring的源码,第一步自然是下载和编译Spring的源码,这个我在之前的博文中已经发表过了。具体可参考:《SpringFramework×××和编译教程》 面对茫茫多的Spring的工程和代码,很多人可能会无从下手。其实想想,Spring也是有入口的,那就是配...

weixin_34206899的博客 177

CNN经典论文(一)LeNet

Gradient-Based Learning Applied to Document Recognition(梯度学习在文档识别中的应用) Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner 发表时间:December 1998 期刊:Proceedings of the IEEE 影响:世界上第一个卷积神经网络 论文地址:Gradient-Based Learning Applied to Document Recognition

loveling丶的博客 3599

转载:AskForHelp

AskForHelp Login 首页 CPUG OpenBookProject 行者堂 更新 搜索 帮助 AskForHelp Immutable Page Info Attachments More Actions: Raw Text Print View Render as Docb...

weixin_34132768的博客 926

CMap与L1000技术解析:基因表达数据在药物发现中的应用

本文深入解析了CMap(连接图)与L1000技术在药物发现中的核心应用。CMap通过构建基因表达“关系网”,实现基于模式匹配的药物重定位;L1000技术则以低成本、高通量方式生成关键基因表达数据,支撑了LINCS超级数据库。文章以CLUE平台为例,手把手演示了如何利用疾病基因表达签名逆向筛选潜在治疗化合物,并拓展了其在解析药物机制、预测副作用等多场景下的价值。

weixin_29207533的博客 728

【实用运维脚本】Windows 批量 TCP 端口检测(tcping 一键巡检)

摘要:本文介绍一款高效的Windows批量TCP端口检测脚本,适配tcpingv0.39工具,实现多服务器一键巡检。脚本具有进度可视化、双日志输出、自动容错等优势,支持注释行过滤和UTF-8编码。 使用仅需三步: 1)下载tcping工具 2)编辑目标列表 3)运行脚本即可自动检测并生成带编号的检测报告。 该方案解决了手动检测效率低、易遗漏的问题,特别适合日常运维中的端口连通性检查,实测稳定可靠,开箱即用。

蕲士|D365 & 服务器运维,心有东坡,行稳致远。 804

FileSystemXmlApplicationContext…

Spring有两个核心接口:BeanFactory 和 ApplicationContext,其中ApplicationContext是BeanFactory 的子接口。它们代表Spring容器,Spring容器是生成Bean实例的工厂,并管理容器中的Bean,Bean是Spring管理的基本单位,在基于spring的javaEE应用中,所有的组件都被当成bean来处理    很多时候, Appl

Sandy Hu的博客 9459

CXSMILES细则-用于在 SMILES 字符串后存储分子的特殊特征

Chemaxon 扩展 SMILES/SMARTS 用于在 SMILES 字符串后存储分子的特殊特征。任何信息都可以存储在 SMILES 字符串后,只要它们由空格或制表符字符分隔,因为 SMILES 解析器会忽略这些信息,或者将它们作为注释使用。扩展特征以以下格式存储:Chemaxon 的扩展 SMILES/SMARTS 不包含非 ASCII 字符,它们通常以字符代码 n 的形式被转义为 &#n;。在 S-group 中,ASCII 字符“,”、“;”、“|”、“{”、“}”也以这种方式转义。此外,符号“$

ASKCOS博客 404

【spring】FileSystemXmlApplicationContext 类学习

它允许你指定是否在创建上下文后立即刷新上下文(这将加载所有的bean定义并启动上下文的生命周期),以及是否指定一个父上下文。它会加载数组中指定的所有配置文件。在创建IOC容器前,如果已经有容器存在,则需要把已有的容器销毁和关闭,以保证在refresh之后使用的是新建立起来的IOC容器。它提供了一种在文件系统上查找和加载XML配置文件的方式,这使得开发者可以轻松地管理和更新应用程序的配置。refresh的作用类似于对IOC容器的重启,在新建立好的容器中对容器进行初始化,对Bean定义资源进行载入。

一个写了10年bug的程序员日常笔记。 1453

91、Windows网络配置:动态更新与名称解析全攻略

本文全面解析了Windows XP Professional系统中的网络配置方法,重点介绍了动态更新和名称解析两大核心功能。动态更新部分涵盖DHCP客户端、静态配置客户端、远程访问客户端和多宿主客户端的配置方法,并提供禁用动态更新和编辑Hosts文件的注意事项。名称解析部分详细讲解了NetBIOS名称解析的基础知识、WINS配置方法、B节点广播与Lmhosts文件的使用,以及WINS代理的作用和配置要点。通过操作建议流程图和关键操作步骤回顾,帮助用户快速掌握网络配置的核心技巧,适用于不同网络环境的实际需求。

blue42的博客 236

Python时间序列:PaddleTS-时间序列分类

评估的指标采用F1,Precision,Recall,PaddleTS已经基于TSDataset实现了这三个指标的计算,直接调用即可。使用内置的API:get_dataset加载BasicMotions数据集。模型训练完成之后,可以对测试集进行预测并评估。模型保存之后,可以加载模型用于新的数据预测。可以将训练完成的模型保存到指定路径。概率预测 可以返回每个分类的概率。安装paddlets。

斌擎科技 1294

Spring源码研究——容器初始化

ApplicationContext context = new FileSystemXmlApplicationContext("f:/workspace/spring3/demo/applicationContext.xml");     新建一个容器,看看后面干了啥 FileSystemXmlApplicationContext(AbstractApplicationContext).r

小9的专栏 968

基于YOLOv8的植物生长阶段识别系统设计与实现

本文详细介绍了一个基于YOLOv8深度学习模型的植物生长阶段识别系统,包含完整的数据集构建、模型训练、评估以及基于PyQt5的用户界面开发过程。系统能够自动识别植物在不同生长阶段(如发芽期、生长期、开花期、结果期等)的形态特征,为精准农业和智能种植提供技术支持。文章提供了完整的代码实现,并讨论了模型优化策略和实际应用场景。关键词:植物生长阶段识别、YOLOv8、目标检测、PyQt5、深度学习。

YOLO 468

spring源码解析之IOC容器(一)

  学习优秀框架的源码,是提升个人技术水平必不可少的一个环节。如果只是停留在知道怎么用,但是不懂其中的来龙去脉,在技术的道路上注定走不长远。最近,学习了一段时间的spring源码,现在整理出来,以便日后温故知新。   IOC容器是spring最核心的模块之一,是整个spring体系的基石,spring其他模块中,都需要用到IOC容器的功能。spring框架为我们提供了多种IOC容器,Default...

weixin_34067102的博客 284

贝叶斯统计 [韦来生编]

贝叶斯(Bayes)统计是近几十年来迅速发展起来的数理统计的一个重要分支。贝叶斯方法与经典统计方法的主要不同之处是进行统计推断时除了利用样本信息外,还要利用参数的先验信息,因此可以提高统计推断或统计决策的效果。它在经济、金融、生物、医学、自然科学和社会科学等许多领域具有广泛的应用。贝叶斯方法的研究已渗透到了统计学的几乎所有领域。作者在给中国科学技术大学概率论与数理统计专业本科生开设的“数理统计”课程中有一章专门讲授“贝叶斯方法和统计决策理论”,近十年来也给中国科学技术大学概率统计专业研究生开设过几次“贝叶斯分析”课。本书是在对过去讲稿的内容作了适当的增减和调整的基础上完成的。  本书共分六章。第1章是绪论,介绍了贝叶斯统计的若干基本概念,同时对必要的数理统计的基础知识有重点地作了回顾。第二章介绍了确定先验分布的若干可供选择的方法。第三章介绍了几类常见统计模型参数的后验分布的主要结果和计算方法。第四章和第五章分别介绍了“贝叶斯统计推断”和“贝叶斯统计决策”的内容。第六章介绍了贝叶斯统计计算的若干方法,包括蒙特卡洛方法和马尔可夫链蒙特卡洛(MCMC)方法以及相关统计软件的简介。本书的每一章附右大量的例题和习题,书末附有常用的几个表格和部分习题解答供读者查用。  大约可在54学时内讲授本书的第1章至第六章的主要内容,教师可根据学时需要选讲本书第1章至第六章的部分内容。书中标“*”号的章节可略去不讲,留给读者作为阅读材料。第六章例题中的R代码和部分例题的数据文件等可从作者个人主页下载。  作者在编写本书的过程中参考了J.O.Berger教授的《统计决策论及贝叶斯分析》和茆诗松教授编写的《贝叶斯统计》等书中的一些内容,以及《贝叶斯分析》一书中由张伟平博士编写的有关贝叶斯统计计算的一些内容。在此表示衷心感谢。  本书编写准备过程中,中国科学技术大学统计与金融系的几个研究生帮助完成了本书部分中文的录入和排版,作者对他们的辛勤工作表示真诚的感谢。高等教育出版社为本书的出版给予了大力支持。在此一并致谢。

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

【初探Spring】——Spring IOC(三):初始化过程—Resource定位

【初探Spring】——Spring IOC(三):初始化过程—Resource定位原创 2016年06月27日 12:43:49标签:Spring /Spring研究 /初探Spring4433我们知道Spring的IoC起到了一个容器的作用,其中装得都是各种各样的Bean。同时在我们刚刚开始学习Spring的时候都是通过xml文件来定义Bean,Spring会某种方式加载这些xml文件,然后根

evilcry2013的博客 315

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

Spring之IoC容器

spring是一个极为庞大和丰富的框架,笔者在此并不想从零开始的去讲解她。关于spring的基础概念等希望读者自行百度。文中会涉及到很多spring的源代码,我并不想在此处大量copy出来,有兴趣的读者可以自己查看学习。再一点,阅读本文之前,读者若有一些spring的开发经验或许能更好的理解本文及spring原理。本文是在阅读了前辈大牛《SPRING技术内幕:深入解析SPRING架构与设计原理》之

jack_wgj的专栏 982

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

ClassXmlAplicationContext、FileSystemXmlApplicationContext

本人在测试一个方法时需要加载XML配置文件,spring提供了相应的方法,就小小研究了下,在此记录下具体的过程,方便初学者和自己日后回顾。      Spring容器最基本的接口就是BeanFactory. BeanFactory负责配置、创建、管理Bean,它有一个子接口ApplicationContext,也称为Spring上下文。Spring容器负责管理Bean与Bean之间的信赖关系

Magister_Feng的专栏 1057

4个关键点,32个核心点,深入研究Spring IOC源码

你好,我是田哥或许你和我一样,都认为看源码最无聊,看着看着就背劝退了。但是心里又很清楚,如果看过xxx源码,研究过 xxx源码,那对面试是加分项。其他什么高大上吹牛逼的话咱们暂且不讨论,我们是个俗人,只想有个好点工作好点的待遇。java在线刷题希望你能静下心来耐心看完,如果暂时没有时间,那建议先收藏。主要内容 文章一共有五大部分,具体如下:一、 什么是Ioc/DI?二、 Spring IOC体系结...

田维常 157

Spring技术内幕(二)------IOC容器概述与设计

1. Spring IoC容器概述 1.1 IoC容器和依赖反转模式 为什么要依赖反转? 在依赖反转时实际是依赖对象的获得被反转了。 如果合作对象的引用或依赖关系的管理由具体对象来完成,会导致代码高耦合和可测试性降低,而在面向对象系统中,对象封装了数据和对数据的处理,对象的依赖关系常常在于对数...

chenzhou6070的博客 204

Spring源码学习-容器初始化之FileSystemXmlApplicationContext(二)路径格式及解析方式(上)...

了解完了构造函数,我们回到上节《Spring源码学习-容器初始化之FileSystemXmlApplicationContext(一)构造函数》留下的思考的问题: 支持路径格式的研究。(绝对?相对?通配符?classpath格式又如何?) 配合placeholder使用的路径问题研究。 路径如何解析? 下面,我们就来一...

weixin_34326558的博客 167

spring源码--06--DI原理--FileSystemXmlApplicationContext

依赖注入 1、 验证过程 代码地址 https://gitee.com/DanShenGuiZu/learnDemo/tree/master/spring源码学习/spring-source-learn/spring-01 1.1、验证代码 public class Test3 { public static void main(String[] args) { String xmlPath = "D:\\java\\workSpace-learn\

zhou920786312的博客 1116

[读书笔记]Spring中IOC容器中FileSystemXmlApplicationContext的初始化详解

接上文[[读书笔记]Spring中IOC容器中XmlBeanFactory的初始化详解](https://janus.blog.youkuaiyun.com/article/details/53196003),我们这里尝试看一下FileSystemXmlApplicationContext这种ApplicationContext的初始化。 FileSystemXmlApplicationContext是独立的 XML application context,从文件系统或URL得到上下文定义文件。URL可以是绝对或者相

小小默:进无止境 4759

FileSystemXmlApplicationContext

BeanFactory有很多实现类,通常使用org.springframework.beans.factory.xml.XmlBeanFactory类。但对于大部分J2EE应用而言,推荐使用ApplicationContext. ApplicationContext是 BeanFactory的子接口,其常用实现类是org.springframework.context.support.Fil...

轻轻草原 697

FileSystemXmlApplicationContext、ClassPathXmlApplicationContext和XmlWebApplicationContext简介

今天在用Spring时遇到一个问题,提示找不到applicationContext.xml文件。原来是在加载这个文件时调用的方法不太合适,所以造成了程序找不到项目下的xml配置文件。   我们常用的加载context文件的方法有如下三个:   1、FileSystemXmlApplicationContext 这个方法是从文件绝对路径加载配置文件,例如: ApplicationCont...

weixin_34367257的博客 385
上一篇: 未初始化的String相 “+“ 为什么会打印出“nullnull“
下一篇: 一起学Java(1)-新建一个Gradle管理的Java项目
CoderCodingNo
博客等级 码龄4年 2041粉丝 635原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值