on 2023 Jul 27 1:05 PM
I developed a filter and wanted to use it in the OCC extension

issing bean 'commerceWebServicesFilterChainListV2'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'commerceWebServicesFilterChainListV2' available
I guess the error is because commerceWebServicesFilterChainListV2 is declared in the web package and yocc extension is declaring in src package.
The question now is. What's the proper way to do this? besides not listenning to SAP and using the yoccaddon
Request clarification before answering.
Have a look at /commercewebservices/web/webroot/WEB-INF/config/v2-web-spring.xml:
<!-- Extension point to inject beans from other sources -->
<import resource="classpath*:/occ/v2/*occ/web/spring/*-web-spring.xml"/>
<import resource="classpath*:/commercewebservices/v2/additional-web-spring-context.xml"/>You can put additional spring config files that will be loaded into OCC web spring context without the need to put them in the web part of your extension (so you can just be using yocc template).
For example: /hybris/bin/modules/configurator-complex-products/sapproductconfigocc/resources/occ/v2/sapproductconfigocc/web/spring/sapproductconfigocc-web-spring.xml
And a link to documentation: https://help.sap.com/docs/SAP_COMMERCE_CLOUD_PUBLIC_CLOUD/3476714bba0b4cb9b3eb58c270e44439/8ef2d8d7b...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Andy,
Yes I did actually use that in one of my projects:
<bean id="customSessionCurrencyFilter" class="(...).CustomSessionCurrencyFilter"/>
<bean depends-on="commerceWebServicesFilterChainListV2" parent="listMergeDirective">
<property name="add" ref="customSessionCurrencyFilter"/>
<property name="afterBeanNames">
<list value-type="java.lang.String">
<value>commerceWebServicesSessionCurrencyFilterV2</value>
</list>
</property>
<property name="beforeBeanNames">
<list value-type="java.lang.String">
<value>cartMatchingFilter</value>
</list>
</property>
</bean>Please check in the logs if your extension is actually loaded. You could also enable DEBUG logging for org.springframework to check if the spring config file is picked up by the platform.
Good luck!
andybugatto You need to set the name of your OCC extension so that it ends with *occ (e.g. trainingocc). Have a look at this pattern: "classpath*:/occ/v2/*occ/web/spring/*-web-spring.xml":
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.