Spring 从文件系统读取配置文件, 使用@PropertySource

spring 使用  绝对路径去读取配置时

@Component

@PropertySource(value = "D://wxpay.properties",encoding="utf-8") //本地配置

是不能这样的,



要这样

@Component

@PropertySource(value = "file:D://wxpay.properties",encoding="utf-8") //本地配置



不然spring 会自动给你的路劲加上  / 也就变成了/D://wxpay.properties 

自然也就会报读取不到配置文件

猜你喜欢

转载自blog.csdn.net/u012930316/article/details/79530579
今日推荐