无法在值“文件:$ {AppPropertyDir} /context.properties”中解析占位符“ AppPropertyDir”

时间:2019-07-24 20:25:36

标签: java spring spring-boot spring-boot-test

在处理简单的字符串注入时,在其他地方找不到这个问题!

import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

@Configuration("appPropertiesLoader")
@PropertySource(value = "file:${AppPropertyDir}/context.properties")
public class AppPropertiesLoader {

    @Value("#{systemProperties.AppPropertyDir}")
    private String appPropertyDir;

}
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'AppPropertyDir' in value "file:${AppPropertyDir}/context.properties"
    at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:174) ~[spring-core-4.3.20.RELEASE.jar:4.3.20.RELEASE]
    at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126) ~[spring-core-4.3.20.RELEASE.jar:4.3.20.RELEASE]

0 个答案:

没有答案
相关问题