Spring配置文件无法分析正确的文件

Spring配置文件无法分析正确的文件,spring,spring-boot,intellij-idea,spring-profiles,Spring,Spring Boot,Intellij Idea,Spring Profiles,这是我用来读取gradle项目中application.properties文件的代码 @PropertySource("${spring.profiles.active}/application.properties") 我的文件位于resources/local/application.properties中 这就是我试图在IntelliJ中运行应用程序的方式 这就是我最终得到的错误 org.springframework.beans.factory.BeanDefinitionStor

这是我用来读取gradle项目中application.properties文件的代码

@PropertySource("${spring.profiles.active}/application.properties")
我的文件位于
resources/local/application.properties中

这就是我试图在IntelliJ中运行应用程序的方式

这就是我最终得到的错误

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.example.core.Application]; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.profiles.active' in value "${spring.profiles.active}/application.properties"

有人能帮我解决这个问题并阅读正确的配置吗。

你正在尝试获取spring.profiles.active但是在Intellij中你正在设置spring.active.profiles

我解决了这个问题,它仍然不起作用。我得到以下错误
org.springframework.beans.factory.BeanDefinitionStoreException:解析配置类[com.example.core.Application]失败;嵌套异常为java.lang.IllegalArgumentException:无法解析值“${spring.active.profiles}/application.properties”中的占位符“spring.active.profiles”
我认为您交换了名称,请尝试spring.profiles.active以获取更多信息检查我已尝试了所有可能的组合。它不起作用。你试过在参数或环境变量中而不是在VMoptions中设置它吗?@Melisastewart请看一看,我认为它也可以帮助你