方法一:在类路径下寻找配置来实例化容器

 1 ApplicationContext ctx = new ClassPathXmlApplicationContext( 2 new String[]{"beans.xml"}); 

方法二:在文件系统路径下寻找配置文件来实例化容器

 1 ApplicationContext ctx = new FileSystemXmlApplicationContext( 2 new String[]{"d:\\beans.xml"}); 

Spring的配置文件可以指定多个,通过string数组传入

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-09
  • 2021-10-05
  • 2021-04-14
  • 2022-12-23
  • 2022-12-23
  • 2022-01-10
猜你喜欢
  • 2022-12-23
  • 2022-01-14
  • 2022-12-23
  • 2021-05-22
  • 2021-08-01
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案