繁体   English   中英

@Value 注释在 Spring 的构造函数依赖注入中是什么意思?

[英]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的默认值吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM