【发布时间】:2018-08-26 23:30:39
【问题描述】:
我在类路径中创建了一个带有 Configuration.properties 文件的 spring-boot 应用程序。但是当我打包它并运行应用程序时,我得到了错误 - “Configuration.properties(系统找不到指定的文件)。” 在以下方法中调用它: 公共静态属性 readProperties() 抛出 IOException {
FileReader reader=new FileReader("Configuration.properties");
Properties p=new Properties();
p.load(reader);
return p;
我是spring的新手,spring-boot。有没有办法在spring-boot应用程序的application.properties(内部资源文件夹)中提供值。 或者为什么我创建的属性文件没有进入 jar(打包时)。 有人可以帮忙吗?
问候, 阿尔宾
【问题讨论】:
标签: java maven spring-boot properties properties-file