79215375

Date: 2024-11-22 14:22:59
Score: 1
Natty:
Report link

It seems that you are trying to use @Validated for spring beans, using Spring MVC approach.

First idea

From this article, looks like you need to declare an additional bean.

@Bean
    public static MethodValidationPostProcessor validationPostProcessor() {
        return new MethodValidationPostProcessor();
    }

Second idea

Instead of relying on @ConditionalOnProperty during creation of MyService you can create a @Conditional bean which will validate values of the properties.

Reasons:
  • Blacklisted phrase (1): this article
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: artiomi