Buggy code:
class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser { private static final boolean javaxValidationPresent = ClassUtils . isPresent ( "javax.validation.Validator" , AnnotationDrivenBeanDefinitionParser . class . getClassLoader ( ) ) ; private static final boolean jaxb2Present = ClassUtils . isPresent ( "javax.xml.bind.Binder" , AnnotationDrivenBeanDefinitionParser . class . getClassLoader ( ) ) ; private static final boolean jackson2Present = ( ClassUtils . isPresent ( "com.fasterxml.jackson.databind.ObjectMapper" , AnnotationDrivenBeanDefinitionParser . class . getClassLoader ( ) ) ) && ( ClassUtils . isPresent ( "com.fasterxml.jackson.core.JsonGenerator" , AnnotationDrivenBeanDefinitionParser . class . getClassLoader ( ) ) ) ; private static final boolean jacksonPresent = ( ClassUtils . isPresent ( "org.codehaus.jackson.map.ObjectMapper" , AnnotationDrivenBeanDefinitionParser . class . getClassLoader ( ) ) ) && ( ClassUtils . isPresent ( "org.codehaus.jackson.JsonGenerator" , AnnotationDrivenBeanDefinitionParser . class . getClassLoader ( ) ) ) ; private static boolean romePresent = ClassUtils . isPresent ( "com.sun.syndication.feed.WireFeed" , AnnotationDrivenBeanDefinitionParser . class . getClassLoader ( ) ) ; @ Override public BeanDefinition parse ( Element element , ParserContext parserContext ) { } private RuntimeBeanReference getConversionService ( Element element , Object source , ParserContext parserContext ) { } private RuntimeBeanReference getValidator ( Element element , Object source , ParserContext parserContext ) { if ( element . hasAttribute ( "validator" ) ) { return new RuntimeBeanReference ( element . getAttribute ( "validator" ) ) ; } else if ( AnnotationDrivenBeanDefinitionParser . javaxValidationPresent ) { <START_BUG> RootBeanDefinition validatorDef = new RootBeanDefinition ( "org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" ) ; <END_BUG> validatorDef . setSource ( source ) ; validatorDef . setRole ( ROLE_INFRASTRUCTURE ) ; String validatorName = parserContext . getReaderContext ( ) . registerWithGeneratedName ( validatorDef ) ; parserContext . registerComponent ( new org . springframework . beans . factory . parsing . BeanComponentDefinition ( validatorDef , validatorName ) ) ; return new RuntimeBeanReference ( validatorName ) ; } else { return null ; } } private RuntimeBeanReference getContentNegotiationManager ( Element element , Object source , ParserContext parserContext ) { } private Properties getDefaultMediaTypes ( ) { } private RuntimeBeanReference getMessageCodesResolver ( Element element , Object source , ParserContext parserContext ) { } private String getAsyncTimeout ( Element element , Object source , ParserContext parserContext ) { } private RuntimeBeanReference getAsyncExecutor ( Element element , Object source , ParserContext parserContext ) { } private ManagedList < ? > getCallableInterceptors ( Element element , Object source , ParserContext parserContext ) { } private ManagedList < ? > getDeferredResultInterceptors ( Element element , Object source , ParserContext parserContext ) { } private ManagedList < ? > getArgumentResolvers ( Element element , ParserContext parserContext ) { } private ManagedList < ? > getReturnValueHandlers ( Element element , Object source , ParserContext parserContext ) { } @ SuppressWarnings ( "deprecation" ) private ManagedList < ? > getMessageConverters ( Element element , Object source , ParserContext parserContext ) { } @ SuppressWarnings ( "rawtypes" ) private RootBeanDefinition createConverterDefinition ( Class < ? extends HttpMessageConverter > converterClass , Object source ) { } private ManagedList < BeanDefinitionHolder > extractBeanSubElements ( Element parentElement , ParserContext parserContext ) { } private ManagedList < BeanDefinitionHolder > wrapWebArgumentResolverBeanDefs ( List < BeanDefinitionHolder > beanDefs , ParserContext parserContext ) { } static class CompositeUriComponentsContributorFactoryBean implements FactoryBean < CompositeUriComponentsContributor > , InitializingBean { private RequestMappingHandlerAdapter handlerAdapter ; private ConversionService conversionService ; private CompositeUriComponentsContributor uriComponentsContributor ; public void setHandlerAdapter ( RequestMappingHandlerAdapter handlerAdapter ) { } public void setConversionService ( ConversionService conversionService ) { } @ Override public void afterPropertiesSet ( ) { } @ Override public CompositeUriComponentsContributor getObject ( ) throws Exception { } @ Override public Class < ? > getObjectType ( ) { } @ Override public boolean isSingleton ( ) { } } }

Fix:
RootBeanDefinition validatorDef = new RootBeanDefinition ( "org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean" ) ;