close

Filter

loading table of contents...

CoreMedia Content Cloud v11 Upgrade Guide / Version 2110

Table Of Contents

6.5.3 Validators by Configuration

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 Section 9.21.1.1, “Declaration of Validators” in Studio Developer Manual for details.

Unfortunately, the option of JSON configuration required some API changes. The validator classes have been widely stripped off their Spring features, especially @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.

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.