【问题标题】:ApplicationContext not able to parse xml file getting ExceptionApplicationContext 无法解析获取异常的 xml 文件
【发布时间】:2018-03-18 06:00:54
【问题描述】:

请帮助我使用 ApplicationContext ap = new ClassPathXmlApplicationContext("resources/spring.xml")

加载和解析我的 spring.xml 文件

图片中给出了文件结构enter image description here

【问题讨论】:

  • 应该是第一行,然后是其他所有内容

标签: spring spring-mvc spring-boot


【解决方案1】:

Spring-Context 需要 Spring-expression 和 Spring-AOP 作为编译依赖。您可以在此处查看所需的依赖项。
https://mvnrepository.com/artifact/org.springframework/spring-context/5.0.4.RELEASE

【讨论】:

  • @KailashChoudhary 我在附图中找不到 spring-expression 和 spring-aop。可能附加的图像已过时。
  • ClassPathXmlApplicationContext 是强制性的吗?因为它适用于 Resource r = new ClassPathResource("resources/spring.xml"); BeanFactory 工厂 = new XmlBeanFactory(r);
  • 感谢@lucid 现在它正在工作,但我想知道为什么 XmlBeanFactory 在这里工作
猜你喜欢
  • 1970-01-01
  • 2014-05-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-07-02
  • 2021-10-06
  • 2010-12-25
相关资源
最近更新 更多