on 2018 Jun 08 6:32 PM
Hi Experts,
Platform already has introduced InitDefaultsInterceptor for type. Now I need to populate one more property for type with default value, and going to introduce second InitDefaultsInterceptor for it.
Just want to confirm, that it is not bad practice to have two InitDefault interceptors. Or it is better to somehow extend(maybe even replace) existing one?
Request clarification before answering.
It's not bad practice, in fact there is an example of using multiple InitDefaults interceptors in the cms2 extension. There is an InitDefaults interceptor on the CMSRelation type and then separate ones on the sub types ContentSlotForPage and ContentSlotForTemplate
If you need your new interceptor to fire before other ones then there is an order attribute, or use the replacedInterceptors to completely replace the existing one.
Also as has pointed out you can just override the default bean with your one but I wouldn't go as far as saying that this is better, it's just a different way of achieving the same result.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.