2 lostrex lostrex 于 2017.09.08 20:32 提问

Spring boot Could not resolve placeholder 10C

在resources目录下配置了application.properties文件,其中:
spring.data.mongodb.uri=mongodb://

每次启动时,都会报错:
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.data.mongodb.uri' in value "${spring.data.mongodb.uri}"

但是之前是可以启动的,代码片段:
@Configuration
public class MongoDataSourceConfiguration {
@Value("${spring.data.mongodb.uri}")
private String uri;

...to do something...

}

请问如何解决呢?

4个回答

caozhy
caozhy   Ds   Rxr 2017.09.08 22:53
ljheee
ljheee   Rxr 2017.09.08 23:03



加上这个

adf1237854
adf1237854   2017.09.09 02:04

lianjunzongsiling
lianjunzongsiling   2017.09.08 20:46
 <context:property-placeholder location="classpath*:redis.properties" ignore-unresolvable="true" />  

看见后面ignore-unresolvable属性没?百度下这个属性估计你问题就解决了

Csdn user default icon
上传中...
上传图片
插入图片