1、檢查配置yml或properties文件中的名字與"$("")"中的是否一致;
2、查看是否寫在包含啟動類下的resources文件夾下,配置文件寫在包含Application類中才有效。文章來源:http://www.zghlxwxcb.cn/news/detail-802488.html
3、檢查是否寫在第一個配置文件(yml / properties)中,因為在第一個配置文件如果找不到就不會繼續(xù)往下找,直接報錯。可以在啟動類(Application)中添加如下Bean,使其繼續(xù)查找后續(xù)的配置文件:文章來源地址http://www.zghlxwxcb.cn/news/detail-802488.html
@Bean
public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() {
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
propertySourcesPlaceholderConfigurer.setIgnoreUnresolvablePlaceholders(true);
return propertySourcesPlaceholderConfigurer;
}
到了這里,關(guān)于Could not resolve placeholder ‘xxx‘ in value “${xxx}“at org.springframe的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!