【发布时间】:2019-01-23 03:48:56
【问题描述】:
我的 Spring Boot 应用程序中有以下配置代码:-
@Configuration
@PropertySources({
@PropertySource(value = "file://${CONFIG_PATH}/folder/application.properties"),
@PropertySource(value = "file://${CONFIG_PATH}/folder/application-log.properties"),
@PropertySource(value = "file://${CONFIG_PATH}/folder/application-persistence.properties"),
@PropertySource(value = "file://${CONFIG_PATH}/folder/application-environment.properties")
})
public class PopulateFixturesConfig {
@Bean
public static PropertySourcesPlaceholderConfigurer
propertySourcesPlaceholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}
}
上面的代码在 Linux 服务器上执行,我在本地机器上有 Windows。因此,当我必须进行开发时,我必须进行更改,我必须在这样的文件之后添加额外的“/”:
@PropertySource(value = "file:///${CONFIG_PATH}/folder/application-environment.properties")
当我必须再次提交代码时,我必须删除多余的“/”。
有什么方法可以让路径对 windows 和 linux 都通用。
谢谢,
【问题讨论】:
标签: linux spring-boot window filepath