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 条评论
登录 后参与评论


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


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

Difference between mail and mailx?

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入门

Annotations Recycler View ItemClick

Java 和 @annotations

What is the difference between component 'mat-table' and the directive '<table mat-table>'?

what is the difference between SAS ARRAY and SAS IF-THEN

What is the difference between parametric polymorphism with upper-bound and subtype polymorphism in these methods?

无法将 `linkerd.io/inject: enabled` 添加到 ArgoCD 清单 - io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta.annotations 的类型无效