我在下面的路径中创建ValidateInterceptor
,并在custombackoffice-backoffice-spring.xml
中创建了bean
C:\ hybris \ bin \ custom \ custombackoffice \ backoffice \ src \ com \ custom \ backoffice \ interceptor \ CustomAppeasementUserValidateInterceptor.java
bean如下
<bean id="customAppeasementUserValidateInterceptor" class="de.hybris.platform.servicelayer.interceptor.impl.InterceptorMapping">
<property name="interceptor" ref="customAppeasementUserValidateInterceptor" />
<property name="typeCode" value="Appeasement" />
</bean>
当我在后台修改特定模型并单击“保存”按钮时,调试器永远不会进入拦截器,它会直接保存模型。
注意:-我无法在customcore中编写此拦截器,因为我们无法在自定义core中导入以下服务 导入com.hybris.cockpitng.core.user.AuthorityGroupService; 导入com.hybris.cockpitng.core.user.impl.AuthorityGroup;
为什么拦截器没有被触发?
答案 0 :(得分:0)
bean-id 和 mapper bean-id 相同。换一个。理想情况下,它应该像-
this.route.params.pipe(
switchMap(params => this.service.getMineral(params.id))).subscribe()
通知映射bean 的新<bean id="customAppeasementUserValidateInterceptorMapping" class="de.hybris.platform.servicelayer.interceptor.impl.InterceptorMapping">
<property name="interceptor" ref="customAppeasementUserValidateInterceptor" />
<property name="typeCode" value="Appeasement" />
</bean>
,即id
。
答案 1 :(得分:0)
您在这里缺少一个bean。您需要为您的类提供bean,并为映射提供bean。
<bean id="customAppeasementUserValidateInterceptorMapping"
class="de.hybris.platform.servicelayer.interceptor.impl.InterceptorMapping">
<property name="interceptor" ref="customAppeasementUserValidateInterceptor"/>
<property name="typeCode" value="Appeasement"/>
</bean>
<bean id="customAppeasementUserValidateInterceptor"
class="com.custom.backoffice.interceptor.CustomAppeasementUserValidateInterceptor">
</bean>