@ConfigurationProperties或@PropertySource不起作用

时间:2014-11-05 16:58:32

标签: java spring annotations spring-boot

我是春季启动的初学者,我尝试使用@ConfigurationProperties或@PropertySource,但我总是得到一个空值

我的application.properties文件:

#application.properties
db.url:https://host.madb

我的班级:

@ConfigurationProperties( locations="classpath:/main/resources/application.properties", prefix = "db")
public class TorSeviceImpl {

//if I use @PropertySource("classpath:/main/resources/application.properties") I ll add : @Value("${db.url}")
private String url; 

但我的url变量始终为null

感谢您的帮助

0 个答案:

没有答案
相关问题