Release Notes / Version 11.2201
Table Of Contents
You can declare validators not only as Spring beans, but alternatively also by JSON configuration files now. This is supported for most core validator classes, except of those which make only sense as singletons and which are provided by default, like the
AvailableLocalesValidator
. Most Blueprint validator classes can easily be enabled for Json configuration in the project, if needed.
See Studio Developer manual / Customizing CoreMedia Studio / Server-Side Content Processing / Validators / Implementation and Activation of Validators for details.
Unfortunately, the option of JSON configuration required some API changes. The validator classes have been widely stripped off their Spring features, esp.
@Autowired
and
InitializingBean
. Not expecting validators to be Spring beans, but just simple POJOs, makes it much easier to instantiate them from JSON configuration files. And the Spring features that were actually used could easily be replaced by other means, like non-null constructor arguments in favor of
@Autowired
, setters and
afterPropertiesSet
checks.
The abstract base classes
PropertyValidatorBase
and
ContentTypeValidatorBase
have been replaced by the Spring-free
AbstractPropertyValidator
and
AbstractContentTypeValidator
, respectively. This affects the constructor signatures and setters of their subclasses, since mandatory configuration is required as constructor arguments now, in favor of setters. The changes are most obvious in the
ValidatorsConfiguration
class in the Blueprint.
If you want to use JSON configuration also for custom validators, the validator classes should refrain from using Spring features like
@Autowired
or
InitializingBean
. Otherwise, you must implement more complex validator factories.
(CMS-18931)