Search code examples
sap-commerce-cloud

How to override hybris platform files other than customize


So, I can see many files under customize folder under platform. Is there any other way to oveerride platform in general other than putting it in customize folder?

If we have to override some OOTB file there are two ways: 1) If its in some extension, we can create customized extension and do our changes. 2) Add stuff into customize folder and do ant customize.

What if OOTB file is in platform? Is there any other way?

I expect to customize platform without adding it to customize folder.


Solution

  • Is the function/bean you want to override is injected through Spring?

    If no, and you need to override say some jar, class or xml. You have choice of ant customize or buildcallbacks.xml

    If yes, it's no different than overriding any other beans from parent extension. The only thing is that you will not need to create an extension dependency as platform is available globally.

    For example : If you wish to override some function in DefaultCatalogDao to give your own implementation. You can do it like...

    1. Create your own implementation extending the platform related service
    2. Inject your custom bean with alias of the defaultCatalogDao
    <alias alias="catalogDao" name="customCatalogDao"/>
    <bean id="customCatalogDao" class="......CustomCatalogDao" parent="defaultCatalogDao"/>
    

    For Commerce Cloud

    You can change platform files using customize folder in Commerce Cloud V2 too. You would need to create a folder in your custom repository with name _CUSTOMIZE_ and then as you do in non cloud version, add your files (with exact folder structure as in platform).

    Once you creare above folder, CCV2 build strategy automatically picks and deploys it, without any additional configuration. Hope it helps!