【发布时间】:2023-04-11 12:20:01
【问题描述】:
我正在尝试找出在ClassPathXmlApplicationContext 的构造函数中指定spring 的XML 文件的语法。通过语法我不是指方法签名,而是实际的字符串
例如以下三个工作。
ApplicationContext context = new ClassPathXmlApplicationContext("com/anshbansal/alarm/alarm.xml");
ApplicationContext context = new ClassPathXmlApplicationContext("classpath:alarm.xml");
ApplicationContext context = new ClassPathXmlApplicationContext("alarm.xml");
我也用谷歌搜索过Spring 3.1.0 源代码。但是我在 org.springframework.core.env.AbstractPropertyResolver Spring 类中的 doResolvePlaceholders 方法之后被卡住了。具体来说,我无法理解占位符如何解析路径。
谁能分享指定xml文件的字符串语法是什么?
编辑
我的意思是在构造函数中指定spring xml文件路径的语法。我不是指xml文件本身的语法。
【问题讨论】:
-
恐怕人家没有回答你的问题,因为问题不清楚。您真正需要的是什么 - 指定 spring xml 文件路径的语法,或者您正在寻找 spring xml 配置文件(其内容)的语法,即 docs.spring.io/spring-framework/docs/current/…?
-
@MichalWilkowski 更新问题后忘记@你了。