Source:
private PartitionKeyExtractorStrategy getPartitionKeyExtractorStrategy(ProducerProperties producerProperties) { PartitionKeyExtractorStrategy partitionKeyExtractor; if (producerProperties.getPartitionKeyExtractorClass() != null) { logger.warn("'partitionKeyExtractorClass' option is deprecated as of v2.0. Please configure partition " + "key extractor as a @Bean that implements 'PartitionKeyExtractorStrategy'. Additionally you can " + "specify 'spring.cloud.stream.bindings.output.producer.partitionKeyExtractorName' to specify which " + "bean to use in the event there are more then one."); partitionKeyExtractor = instantiate(producerProperties.getPartitionKeyExtractorClass(), PartitionKeyExtractorStrategy.class); } else if (StringUtils.hasText(producerProperties.getPartitionKeyExtractorName())) { partitionKeyExtractor = this.partitionKeyExtractors.get(producerProperties.getPartitionKeyExtractorName()); Assert.notNull(partitionKeyExtractor, "PartitionKeyExtractorStrategy bean with the name '" + producerProperties.getPartitionKeyExtractorName() + "' can not be found. Has it been configured (e.g., @Bean)?"); } else { Assert.isTrue(CollectionUtils.isEmpty(this.partitionKeyExtractors) || this.partitionKeyExtractors.size() == 1, "Multiple beans of type 'PartitionKeyExtractorStrategy' found. " + this.partitionKeyExtractors + ". Please " + "use 'spring.cloud.stream.bindings.output.producer.partitionKeyExtractorName' property to specify " + "the name of the bean to be used."); partitionKeyExtractor = CollectionUtils.isEmpty(this.partitionKeyExtractors) ? null : this.partitionKeyExtractors.values().iterator().next(); } return partitionKeyExtractor; }

Target:
private PartitionKeyExtractorStrategy getPartitionKeyExtractorStrategy(ProducerProperties producerProperties) { PartitionKeyExtractorStrategy partitionKeyExtractor; if (producerProperties.getPartitionKeyExtractorClass() != null) { logger.warn("'partitionKeyExtractorClass' option is deprecated as of v2.0. Please configure partition " + "key extractor as a @Bean that implements 'PartitionKeyExtractorStrategy'. Additionally you can " + "specify 'spring.cloud.stream.bindings.output.producer.partitionKeyExtractorName' to specify which " + "bean to use in the event there are more then one."); partitionKeyExtractor = instantiate(producerProperties.getPartitionKeyExtractorClass(), PartitionKeyExtractorStrategy.class); } else if (StringUtils.hasText(producerProperties.getPartitionKeyExtractorName())) { partitionKeyExtractor = this.partitionKeyExtractors.get(producerProperties.getPartitionKeyExtractorName()); Assert.notNull(partitionKeyExtractor, "PartitionKeyExtractorStrategy bean with the name '" + producerProperties.getPartitionKeyExtractorName() + "' can not be found. Has it been configured (e.g., @Bean)?"); } else { Assert.isTrue(CollectionUtils.isEmpty(this.partitionKeyExtractors) || this.partitionKeyExtractors.size() <= 1, "Multiple beans of type 'PartitionKeyExtractorStrategy' found. " + this.partitionKeyExtractors + ". Please " + "use 'spring.cloud.stream.bindings.output.producer.partitionKeyExtractorName' property to specify " + "the name of the bean to be used."); partitionKeyExtractor = CollectionUtils.isEmpty(this.partitionKeyExtractors) ? null : this.partitionKeyExtractors.values().iterator().next(); } return partitionKeyExtractor; }