Difference between @Inject and @ValueMapValue annotations

Tadija Malić :

While reading AEM documentation about using models, I couldn't figure out what is the difference between @Inject and @ValueMapValue annotation above the field.

I tried using both, and they both seems the same, so I must be missing something.

awd :

They are not the same, @Inject is a general purpose annotation that makes the value available from a number of injectors.

@ValueMapValue is an injector specific annotation that will specifically pick value from valuemap injector. It is equivalent to @Inject @Source("valuemap")

When the injected value is available only from one injector, their behavior would be the same, however if the same property is provided by two different injectors (say script-binding and valuemap) they might inject different values. Read more here.

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Scala和@Inject批注

如何使用@Inject?

Difference between window.location.href and top.location.href

javax.inject.Inject和com.google.inject.Inject有什么区别?

@Inject和@ValueMapValue批注之间的区别

javax.inject @Inject无法正常工作

Difference between authorization and sale transactions method in paypal

What's the difference between `make:console` and `make:command`?

Difference between git reset --hard HEAD^ vs git reset --hard HEAD?

Difference between composer update and composer global update

user.groups.add(group) or group.user_set.add(user), Which is better and why ? or difference between them

What is the difference between PWA and Angular 2/4 application?

What is the difference between (a+b)* and (a*b*)*?

A difference between Unicode and ASCII operators

@Inject的依赖注入

Difference between mail and mailx?

@Inject的原型可能吗?

What is the difference between /opt and /usr/local?

Difference between nohup, disown and &

Difference between ! vs !! vs * in /etc/shadow

If I do not understand the difference in stability between Debian stable and Debian testing, am I better off with Debian testing?

Is there a difference between an I/O port and a physical port?

What is the difference between running a .bat from cmd line vs. double click?

Some confusion about listening and open ports, difference between listening, open and blocked

MIPS lw semantics: difference between "lw $t2, $t0" and "lw $t2, ($t0)"?

Is there a quality difference between YouTube videos on Chrome vs. Firefox?

What is the difference between these two SQL Server connection strings

$ inject入门

@Inject @ThirteenNumber 抛出 NullPointException

TOP 榜单

热门标签

归档