Until AEM 6.2/6.3 @Named annotation was working as expected but in AEM 6.4 it does not seem to be working i.e. for example if property name is desc in jcr repository but in respective sling model if below is the code then property values are not injected.
private String shortDescription;
Am i missing something here? Is there any alternative to @Named annotation in AEM 6.4 and versions above?
If you are asking about Apache Sling Models APIorg.apache.sling.models.api) version, it is 1.3.8
Usecase is we are using a sling model for a component where for example if property name is pId but would prefer variable name in respective sling model as productId, we were using below code in AEM 6.2 which was working fine
@Named("pId") private String productid;
We recently upgraded to AEM 6.4 where the above piece of code stopped working.
We have replaced @Inject with @ValueMapValue but could not achieve the functionality with @Named.
Solution proposed by shashi1223 i.e. @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL,name = "pId") worked.