[ https://issues.apache.org/jira/browse/KAFKA-8619?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16876115#comment-16876115 ]
Graeme Rocher commented on KAFKA-8619: -------------------------------------- To make this consistent the same check should exist here: https://github.com/apache/kafka/blob/53b837f9c604cdb8a5a77a9363fc058b9ef9cd7e/clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java#L371 > Allow instances to be passed instead of Classes or Strings for configuration > ---------------------------------------------------------------------------- > > Key: KAFKA-8619 > URL: https://issues.apache.org/jira/browse/KAFKA-8619 > Project: Kafka > Issue Type: Wish > Reporter: Graeme Rocher > Priority: Major > Fix For: 2.3.0 > > > The getConfiguredInstances method of AbstractConfig currently forces values > to be either a Class instantiated directly by Kafka or a String that uses > dynamic classloading. > This limits how DI systems can integrate with Kafka since if you want to > inject an existing Spring, Micronaut, Guice etc. bean to for example by your > Metrics reporter then there is no way to do that currently. > What would be useful is if a simple statement such as: > {code} > if (t.isInstance(klazz)) { > o = klazz; > } > {code} > Could be added here: > https://github.com/apache/kafka/blob/53b837f9c604cdb8a5a77a9363fc058b9ef9cd7e/clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java#L421 > This would make it possible to specify instances that are not instantiated by > Kafka. -- This message was sent by Atlassian JIRA (v7.6.3#76005)