![](/img/trans.png)
[英]Spring DI: Injection of FileInputStream in Constructor using annotation
[英]What does @Value annotation mean in Constructor depedency injection in Spring?
我有一个看起来像这样的片段
@Component
public class Inspiration {
private String lyric =
"I can keep the door cracked open, to let light through";
public Inspiration(
@Value("For all my running, I can understand") String lyric) {
this.lyric = lyric;
}
public String getLyric() {
return lyric;
}
public void setLyric(String lyric) {
this.lyric = lyric;
}
}
@Value("For all my running, I can understand")
这里是什么意思,代表参数lyric的默认值吗?
我希望你能在这里得到你的解释: https ://books.google.co.in/books?id=N-U5DwAAQBAJ&pg=PA64&lpg=PA64&dq=@Value(%22For+all+my+running,+I+can+ understand%22)&source=bl&ots=lOIHkwsF8l&sig=ACfU3U2CAxlxIuYSh3A7dvCaQZiVmLauGw&hl=en&sa=X&ved=2ahUKEwjVlun_5tH4AhUeaGwGHcvPB8UQ6AF6BAgDEAM#v=onepage&q=%40Value(%22For%20all%20my%20running%2C%20I%20can%20understand%22)&f=false
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.