目的:html
实如今配置文件中,进行组装spring
一、Properties文件配置以下:spa
dns=http://211.103.227.133:8080code
qrcode=${dns}/wx/views/invite/register.html
htm
相似域名和公共的东西,但愿在properties文件中直接进行组装,而不是在代码中进行组装blog
二、使用spring注解 @Value注解dns
注意:图中使用@Service或 @Component,而且@Value必须写在set属性上,不然取不到值get
由于定义的qr_code是static ; 若是是非static变量,则能够取到值域名
输出结果为:it