如何为自定义逻辑扩展组件?(how to extend a component for custom logic?)

编程入门 行业动态 更新时间:2024-10-07 00:12:43
如何为自定义逻辑扩展组件?(how to extend a component for custom logic?)

在BLC中,我想提供自定义逻辑来验证运费和结算表单。 这两个验证器在下面的代码中定义,分别在BroadleafShippingInfoController和BroadleafBillingInfoController中使用。

@Component("blShippingInfoFormValidator") public class ShippingInfoFormValidator implements Validator @Component("blBillingInfoFormValidator") public class BillingInfoFormValidator implements Validator

有什么办法可以创建我的自定义验证器类,可以用它来代替BLC框架中的ShippingInfoFormValidator和BillingInfoFormValidator?

In BLC, I want to provide custom logic to validate shipping and billing form. The two validators are defined as in below code and are being used in BroadleafShippingInfoController and BroadleafBillingInfoController respectively.

@Component("blShippingInfoFormValidator") public class ShippingInfoFormValidator implements Validator @Component("blBillingInfoFormValidator") public class BillingInfoFormValidator implements Validator

Is there any way by which I can create my custom validator classes which can be used in place of ShippingInfoFormValidator and BillingInfoFormValidator in BLC framework?

最满意答案

找到了一种方法,它更多的是弹簧配置而不是其他任何东西。

假设CustomShippingInfoFormValidator是ShippingInfoFormValidator的扩展,那么我只需要在spring配置文件中添加以下行

<bean id="blShippingInfoFormValidator" class="package.to.CustomShippingInfoFormValidator" />

Found a way to do this, it is more of spring configuration than anything else.

Suppose CustomShippingInfoFormValidator is an extension of ShippingInfoFormValidator then i just have to add following line to spring configuration file

<bean id="blShippingInfoFormValidator" class="package.to.CustomShippingInfoFormValidator" />

更多推荐

BillingInfoFormValidator,BLC,定义,ShippingInfoFormValidator,验证,电脑培训,计算机培训,IT培训&quo

本文发布于:2023-08-07 12:53:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1464062.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自定义   何为   组件   逻辑   custom

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!