Search code examples
springdependency-injectionsap-commerce-cloud

Hybris OOTB bean is not being injected


Debugging , I see that the attribute customPopulators of OOTB class:

de.hybris.platform.cmsfacades.cmsitems.converter.DefaultCMSItemConverter

Isn't being injected (however the other attributes are being injected) despite of being well configured via XML.

<alias name="defaultCMSItemConverter" alias="cmsItemConverter"/>
    <bean name="defaultCMSItemConverter" parent="baseCMSItemConverter">
        <property name="attributeStrategyConverter" ref="cmsAttributeStrategyConverter"/>
        <property name="attributeValueToRepresentationStrategy" ref="cmsAttributeValueToRepresentationStrategy" />
        <property name="composedTypeToAttributeCollectionConverter" ref="cmsComposedTypeToAttributeCollectionConverter" />
        <property name="customPopulators" ref="cmsItemConverterCustomPopulators" />
        <property name="nestedOrPartOfAttributePredicate" ref="cmsNestedOrPartOfAttributePredicate" />
    </bean> 

So I need to re-inject via spring in some way this attribute again , how can I achieve this ?

If we execute this script in the hac -> groovy console we will see that is empty:

enter image description here

enter image description here


Solution

  • From what I can see your groovy script is retrieving another bean(i.e defaultCmsRenderingCmsItemConverter) not the one for which you provided a definition which is cmsItemConverter