Source:
protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) { BeanDefinitionBuilder dbFactoryBuilder = BeanDefinitionBuilder.genericBeanDefinition(SimpleMongoDbFactory.class); setPropertyValue(dbFactoryBuilder, element, "write-concern", "writeConcern"); BeanDefinition mongoUri = getMongoUri(element); if (mongoUri != null) { if (element.hasAttribute("mongo-ref") || element.hasAttribute("dbname") || element.hasAttribute("authentication-dbname") || element.hasAttribute("port") || element.hasAttribute("host") || element.hasAttribute("username") || element.hasAttribute("password")) { parserContext.getReaderContext().error("Configure either Mongo URI or details individually!", parserContext.extractSource(element)); } dbFactoryBuilder.addConstructorArgValue(mongoUri); return getSourceBeanDefinition(dbFactoryBuilder, parserContext, element); } BeanComponentDefinitionBuilder helper = new BeanComponentDefinitionBuilder(element, parserContext); String mongoRef = element.getAttribute("mongo-ref"); String dbname = element.getAttribute("dbname"); BeanDefinition userCredentials = getUserCredentialsBeanDefinition(element, parserContext); if (StringUtils.hasText(mongoRef)) { dbFactoryBuilder.addConstructorArgReference(mongoRef); } else { dbFactoryBuilder.addConstructorArgValue(registerMongoBeanDefinition(element, parserContext)); } dbFactoryBuilder.addConstructorArgValue(StringUtils.hasText(dbname) ? dbname : "db"); dbFactoryBuilder.addConstructorArgValue(userCredentials); dbFactoryBuilder.addConstructorArgValue(element.getAttribute("authentication-dbname")); BeanDefinitionBuilder writeConcernPropertyEditorBuilder = getWriteConcernPropertyEditorBuilder(); BeanComponentDefinition component = helper.getComponent(writeConcernPropertyEditorBuilder); parserContext.registerBeanComponent(component); return (AbstractBeanDefinition) helper.getComponentIdButFallback(dbFactoryBuilder, BeanNames.DB_FACTORY_BEAN_NAME) .getBeanDefinition(); }

Target:
protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) { BeanDefinitionBuilder dbFactoryBuilder = BeanDefinitionBuilder.genericBeanDefinition(SimpleMongoDbFactory.class); setPropertyValue(dbFactoryBuilder, element, "write-concern", "writeConcern"); BeanDefinition mongoUri = getMongoUri(element); if (mongoUri != null) { int allowedAttributesCount = 1; for (String attribute : MONGO_URI_ALLOWED_ADDITIONAL_ATTRIBUTES) { if (element.hasAttribute(attribute)) { allowedAttributesCount++; } } if (element.getAttributes().getLength() > allowedAttributesCount) { parserContext.getReaderContext().error("Configure either Mongo URI or details individually!", parserContext.extractSource(element)); } dbFactoryBuilder.addConstructorArgValue(mongoUri); return getSourceBeanDefinition(dbFactoryBuilder, parserContext, element); } BeanComponentDefinitionBuilder helper = new BeanComponentDefinitionBuilder(element, parserContext); String mongoRef = element.getAttribute("mongo-ref"); String dbname = element.getAttribute("dbname"); BeanDefinition userCredentials = getUserCredentialsBeanDefinition(element, parserContext); if (StringUtils.hasText(mongoRef)) { dbFactoryBuilder.addConstructorArgReference(mongoRef); } else { dbFactoryBuilder.addConstructorArgValue(registerMongoBeanDefinition(element, parserContext)); } dbFactoryBuilder.addConstructorArgValue(StringUtils.hasText(dbname) ? dbname : "db"); dbFactoryBuilder.addConstructorArgValue(userCredentials); dbFactoryBuilder.addConstructorArgValue(element.getAttribute("authentication-dbname")); BeanDefinitionBuilder writeConcernPropertyEditorBuilder = getWriteConcernPropertyEditorBuilder(); BeanComponentDefinition component = helper.getComponent(writeConcernPropertyEditorBuilder); parserContext.registerBeanComponent(component); return (AbstractBeanDefinition) helper.getComponentIdButFallback(dbFactoryBuilder, BeanNames.DB_FACTORY_BEAN_NAME) .getBeanDefinition(); }