当前位置:首页>财经>正文

Spring加载配置文件(org.springframework.beans.factory.BeanDefinitionStoreException)

2024-01-03 11:00:28 互联网 未知 财经

Spring加载配置文件(org.springframework.beans.factory.BeanDefinitionStoreException)?

Spring加载配置文件(org.springframework.beans.factory.BeanDefinitionStoreException)

1、首先手动加载Spring配置文件有两个类,分别是ClassPathXmlApplicationFileSystemXmlApplicationContext;两个类的区别。

2、然后就是“classpath:”是可以缺省的。如果是绝对路径,就需要加上“file:”前缀,注意的是不可缺省FileSystemXmlApplicationContext的。

3、最后就是通过@PropertySource注解,这时候就是实现配置文件加载用法示例:在java类文件中使用PropertySource即可。